Summary: | Handling of missing glyphs in fonts | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Till Kamppeter <till.kamppeter> |
Component: | Font API | Assignee: | Ken Sharp <ken.sharp> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | htl10 |
Priority: | P4 | Keywords: | bountiable |
Version: | master | ||
Hardware: | All | ||
OS: | All | ||
Customer: | Word Size: | --- |
Description
Till Kamppeter
2007-04-29 10:14:57 UTC
If we do add support for this non standard behavior, it should ONLY be done when an option is specified for "ESP" like behavior. Changing the glyph shown for undefined glyphs is not backward compatible. I was in the discussion (on cups-devel or somewhere?) with Mike Sweet, and as far as my impression of what the PS font-related specs says, .notdef is the one-and-only recommendation when a glyph is not found. What .notdef looks like differs of course on a font-by-font basis. I am still of the opinion that missing glyph should be replaced by .notdef first (or only), and maybe space or other after... Hmm, I'm coming into this thread with no background, could Till or Hin-Tak help me out here please ? Are we referring to PostScript (type 1, type 3, CID etc) or TrueType fonts ? From my understanding of the spec(s), a font *must* contain a .notdef as the bare minimum, precisely to handle the condition of missing glyphs. A font which does not contain a .notdef is an invalid font. If I remember correctly, the equivalent in a TrueType font is the glyph whose ID is 0. When a glyph is missing in a font, it must be replaced by the .notdef glyph (GID 0 for TT). As Hin-Tak says, what a .notdef looks like is entirely up to the font designer, most PostScript fonts use a glyph which draws nothing, most TrueType fonts use a hollow rectangle (which is a common cause of complaint about glyphs being replaced with squares). There are exceptions to both these cases. From Till's original comment, I infer that what we have here is a discussion about TrueType fonts, where glyph 0 is the 'hollow rectangle', the common case. I'm assuming that there are complaints because the missing glyph is substituted by the rectangle, and that Acrobat just shows an empty space. I've tried in the past to decipher what rules Acrobat uses for this, and failed. Sometimes it shows GID 0, sometimes it draws nothing. If this is the problem, then one possible proposal is to add a new contrl (eg UseTrueTypeNotDef) which defaults to true and causes GS to use the glyph at ID 0 for missing TrueType glyphs. When the control is false, GS simply elides the glyph, and moves the current point, effectively replacing with a space. Comments, opinions ? Did I completely misunderstand the problem ? <sigh> And indeed there already exists a control for rendering of TrueType .notdef glyphs. Its called 'RenderTTNotdef' and if true the .notdef is rendered, if false it isn't. Which I should have remembered, because I added it <blush> Till, Hin-Tak, could you look at this and see if you think it is sufficient to resolve this issue please ? For your reference the change was made in revision 8631 to fix bug #689757, which was opened as a PDF writer problem. There is more information in the log accompanying revision 8631. I think this is OK, so you can switch between whether a hollow rectangle should appear or simply blank space. I would say that's it. The original motivation was that some cups customers complains of seeing unsighty squares. (IMHO, despite it being the "correct" behavior according to spec - it is just .notdef and .notdef could be anything the font vendor decides). So the desired behavior - though considered off-spec - is to ignore the presence of .notdef and uses "space" (if it is a text font). That's my understanding of the problem. Till, Hin-Tak, thanks for your input. It seems certain that the RenderTTNotdef switch does do what is required here, so I'll close this issue. For the record, this switch is documented in /gs/doc/Use.htm, defaults to true for PostScript and false for PDF files. |