Follow-up Comment #5, bug #68923 (group groff): Branden is not completely wrong. He is correct that both troff and grops share the same library code to read groff fonts into memory, and gropdf doesn't (neither does afmtodit which creates the files read by the library routines0. The library code reads the charset data into a type of hashed lookup keyed on the value of the first column (which could be a duplicate), and so does gropdf. The difference is what they do when they find a duplicate, the library seems to replace the 'old' entry with the new one, gropdf checks if it would be a duplicate and discards the new entry.
Both methods are incorrect because alhough the characters are the same (when
normalised) the glyphs are different, and so we are in danger of delivering
the wrong glyph based on the users actual input. This can only be "solved" by
using a unique key in our font files.
Branden is wrong in saying we can only deduce what is happening when we have
the super-sized .pchar directive, We have the \w and subsequent \n[rst] which
will report the library's view of the width and height of a particular glyph,
e.g. \w'\[u03B9]'. These come from the first two fields in the glyphs
meta-data in column 2 (adjusted to the current font size). So by comparing
these numbers with the entries in column 2 we can deduce which entry the
library routines are using.
Here's all the duplicate glyphs in the Tinos font which have a difference in
the meta-data, so would affect groff's calculation when line filling with
glyphs:-
TinosR:-
aa 333,696 2 180 acute -- 00B4
aa 333,706 2 2441 uni1FFD -- 1FFD <-- 333,706
------------------------------------------------------------
ga 333,696 2 96 grave -- 0060
ga 333,706 2 2430 uni1FEF -- 1FEF <-- 333,706
------------------------------------------------------------
pc 333,391 0 183 uni00B7
pc 277,391 0 380 anoteleia -- 0387
pc 250,391 0 611 periodcentered -- 00B7 <-- 250,391
------------------------------------------------------------
u02B9 218,655 2 1042 uni02B9
u02B9 333,706 2 1366 uni0374 <-- 333,706
------------------------------------------------------------
u0300 0,892 2 505 gravecomb -- 0300
u0300 0,696 2 1318 uni0340 <-- 0,696
------------------------------------------------------------
u0301 0,892 2 362 acutecomb -- 0301
u0301 0,696 2 1319 uni0341 <-- 0,696
------------------------------------------------------------
u0309 0,896 2 526 hookabovecomb -- 0309
u0309 0,690 2 1263 uni0309 <-- 0,690
------------------------------------------------------------
u0313 0,727 2 1274 uni0313
u0313 0,705 2 1321 uni0343 <-- 0,705
------------------------------------------------------------
u0395_0301 693,656 2 280 Epsilontonos -- 0388
u0395_0301 759,656 2 2395 uni1FC9 <-- 759,656
------------------------------------------------------------
u0397_0301 808,656 2 282 Etatonos -- 0389
u0397_0301 870,656 2 2397 uni1FCB <-- 870,656
------------------------------------------------------------
u0399_0301 411,656 2 296 Iotatonos -- 038A
u0399_0301 481,656 2 2411 uni1FDB <-- 481,656
------------------------------------------------------------
u039F_0301 722,663,10 2 317 Omicrontonos -- 038C
u039F_0301 772,663,10 2 2437 uni1FF9 <-- 772,663
------------------------------------------------------------
u03A5_0301 815,656 2 342 Upsilontonos -- 038E
u03A5_0301 899,656 2 2426 uni1FEB <-- 899,656
------------------------------------------------------------
u03A9 768,663 2 311 Ohm -- 2126 <-- 768,663
u03A9 743,663 2 314 Omega -- 03A9
u03A9 768,663 2 2504 uni2126 <-- 768,663
------------------------------------------------------------
u03A9_0301 743,663 2 315 Omegatonos -- 038F
u03A9_0301 774,663 2 2439 uni1FFB <-- 774,663
------------------------------------------------------------
u03B9 269,459,10 0 541 iota -- 03B9
u03B9 333,0,217 1 2385 uni1FBE <-- 333,0
------------------------------------------------------------
u03B9_0308_0301 269,720,10 2 543 iotadieresistonos -- 0390
u03B9_0308_0301 269,816,10 2 2405 uni1FD3 <-- 269,816
------------------------------------------------------------
u03C5_0308_0301 495,816,10 2 2418 uni1FE3
u03C5_0308_0301 495,720,10 2 2614 upsilondieresistonos -- 03B0
<-- 495,720
------------------------------------------------------------
The lines with "<--" are the entries which match the meta-data from column 2,
so must be the entry the library routine is using. You can see it is generally
using the last entry in a group.
Gropdf uses the first entry because in most cases this is the "correct" entry.
Correctness, in this case, is measured as which entry is the primary glyph for
a particular character. For example in the first pair \[aa] U+00B4 is the
correct entry, U+1FFD is Greek oxia which as a character is the same as an
acute but as a glyph can be different (a slightly taller glyph).
There are several examples with a tonos above a greek capital, which are
paired with the same letter with an oxia. If a user has entered the code
Etatonos U+0389 we should provide the glyph for it, not the version where the
glyph is using an oxia instead.
Generally, the primary glyph occurs first in the font, but this is not a hard
and fast rule. Looking at Ohm/Omega with a triplicate we both get it wrong! If
a user enters the charcter U+03A9 for Omega both use the glyph for Ohm U+2126
(because it occurs twice as 1st (gropdf) and 3rd (library)) the correct entry
is the 2nd one.
It's a mess. The decision to normalise input is a mistake, since it creates
duplicates, (but it is not Branden's - when I asked what advantages there were
(for groff) in normalising to NFD he suggested I ask someone else).
Troff is not a word processor which needs to track both input characters
(normalised for searching/spell checking) and the precise glyph which
corresponds to the input code. This is why you can input both U+03B9 and
U+1FFB (different forms of iota) to a word rocessor, both are found when
searching for "iotas" but separate glyphs are shown on output. Troff and
afmtodit do not use the original input code to access font entries, but rather
the NFD normalised code.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68923>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
