New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OVERLAP_SIMPLE and OVERLAP_COMPOUND #626
Comments
|
To properly reflect the FreeType use case, the proposed changes might read like this. Simple Glyph Flags Some rasterizer implementations can use the OVERLAP_SIMPLE flag to ensure that a non-zero-fill algorithm is used rather than an even-odd-fill algorithm to avoid wrong overlap appearance. (See the discussion of “Overlapping contours” in Apple’s specification for details regarding behavior in Apple platforms.) In addition, some rasterizer implementations based on cumulative pixel coverage need this flag to mitigate artifacts at the intersection pixels. Note that variable fonts often make use of overlapping contours and some implementations might only check this flag in non-variable fonts. This has implications for tools that generate static-font data for a specific instance of a variable font. If a glyph has overlapping contours in the given variation instance, then the tool should either set this flag in the derived glyph data, or else should merge contours to remove overlap of separate contours. This flag can be used in order to provide broad interoperability of fonts when glyphs have overlapping contours. Composite Glyph Flags |
|
[reposting from #922] There are two kinds of rasterizers in use:
Importantly, besides the even-odd and non-zero fill rule, this is also about smudging at the overlapping edges. See the macOS issue microsoft/cascadia-code#362. FreeType now actively uses the OVERLAP flags to mitigate the smudging issue. The issue is especially nasty when two contour edges overlap and produce consecutive runs of incorrect pixels. Overlaps with simple contour crossings are not too bad because a single incorrect pixel is hardly noticeable at the corner. Even though variable fonts frequently use overlaps, the designers should be educated about the nasty edge smudging. Then they could decide if the OVERLAP flag is appropriate or not. Assuming overlaps in all variable glyphs is a bad idea because mitigation is computationally costly and unnecessary if overlaps do not reach edges. In summary, optional OVERLAP flags at the discretion of a font designer is a good thing in both variable and static fonts. They help the trapezoid rasterizers deal with smudged edges. I want to hope that the conflict of interest between different rasterizers can be resolved in the specifications. |
|
"...implementations based on cumulative pixel coverage need this flag..." and "...mitigation is computationally costly..." are implementatins details, don't really belong to a specification? The last sentence "I want to hope that the conflict of interest between different rasterizers can be resolved in the specifications." also sounds a lot like wishful thinking: (1) I am not saying other rasterizers don't adhere to specs, but adhering to specs is not necessarily their main or only concerns... (2) there will always be conflict of interests - vendors will and do intentionally behave differ from each other, as a business advantage... This sounds a lot like "let's push these restrictions into the spec, and hope others will obey the restrictions (restrospectively, and put in audits, and enhancements to enforce the restrictions)".... |
|
@HinTak Please do not mix my explanation from Jan 8, 2024 and proposal from Sept 21, 2020. In fact, I propose to remove implementation details and do not add any restriction. I agree that implementation details limit the scope of the flag, which remains optional. "In addition, some rasterizer implementations based on cumulative pixel coverage need this flag to mitigate artifacts at the intersection pixels." Anything wrong with this sentence? |
|
The original language dates back to 90s and focuses on the fill rule only. No one could have anticipated that overlaps may have issues with anti-aliased rendering back then. All I am asking is to modernize the language to reflect the current state-of-the-art. |
|
See the OT 1.9.1 alpha for draft revisions addressing this issue. |
OVERLAP_SIMPLE and OVERLAP_COMPOUND may have been used in the past to enforce the non-zero winding rule in the PostScript printer drivers. There is another problem with rendering overlaps that requires oversampling. The flags can be used to alert about the overlaps and trigger oversampling in the totally different context unrelated to the winding rule.
The OVERLAP_SIMPLE flag is used by some rasterizer implementations to ensure that a non-zero-fill algorithm is used rather than an even-odd-fill algorithm. Implementations that always use a non-zero-fill algorithm will ignore this flag.
I propose removing the second suggestive sentence and simply say
The OVERLAP_SIMPLE flag is used by some rasterizer implementations to enforce a non-zero-fill algorithm or resolve any other rendering issues.
(See the discussion of “Overlapping contours” in Apple’s specification for details regarding behavior in Apple platforms.)
Other platforms (FreeType) can use it differently. I propose moving this at the end of the paragraph below the table or removing altogether because the description is already self-sufficient.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: