New to Typophile? Accounts are free, and easy to set up.
I have a font with all the diacritical Latin flattened, that is, precomposed and decomposed with no trace of anchors whatsoever. I would want to reverse-engineer placement of anchors if there indeed were any or other effectively same preplanning. Now, doing this somewhat intuitively and matching it all by trial and error is obviously insane. Do you guys know any step-by-step algorithm that would make such a task a finite one or at least determine there was no approximate anchoring in the first place?
14 Jan 2012 — 5:41pm
I imagine the best way would be to write a Python script that
would take measurements and figure out the original numbers.
hhp
15 Jan 2012 — 2:45am
I don't think there'd be a way to figure out where the original anchors were, because anchors positions are arbitrary in relation to the glyphs as long as they match up between the base glyph and the mark.
If you're planning to create more composite glyphs you wouldn't necessarily need to have details of the original anchors though. I'm not sure what your aim is.
15 Jan 2012 — 9:49am
Well, I just want to play with it as a font of only Unicode-based diacritical combining. It’s not for any historical record, so it doesn’t matter if my anchors would reflect the original ones as long as diacritics placement would be the same. Ironically, this arbitrariness in character to diacritic anchor matching is exactly what I was afraid of and what is the trickiest part of the task. Anyway, some utility that would somehow heuristically figure out such anchoring or even its approximation would be quite useful, I think, at least for modernizing old fonts. I’ll give it some more thought.
15 Jan 2012 — 10:08am
Ben, I guess I didn't mean "original" (which does indeed seem
impossible) I meant an "extraction" that would reproduce the
same results (which is entirely possible, although it requires
programming). Speaking of which: no heuristics necessary,
it would "just" be an algorithm.
hhp
15 Jan 2012 — 4:02pm
Let us assume that like in the Adobe example
@TOP_MARKSof Mark-to-Base attachment positioning, we have the base lettersa, e, o, uand the diacriticsacute, grave, dieresis, umlaut. Then it is true that to get the glyph foraacuteall you need to do is to match the basis anchor for theaand the anchor for theacute, and you can decide arbitrarily to put either anchor wherever you want. For instance you can put the base anchor foraat(0,0). However, when you have done that arbitrary choice, all the other anchor positions are fixed; indeed, there is then only one position for the anchors ofacute, grave, dieresis, umlautthat will give the right looking glyph foraacute, agrave, adieresis, aumlautwhen matching with the anchor for theaat(0,0), and then there is also only one possible position for the base anchor one, oanduthat will match any of the anchors on the diacritics. The choice is thus unique up to a translation of all anchor pairs (you can add the same number to all x values, and the same other number to all y values of the anchor positions).In terms of programming, you can initialize one of the anchors to whatever pair you want, and then run some algorithm. Now, I don't know what tools are available, I will just try to illustrate with one tool I use, namely FontForge. Here is a small script that takes as input a fontfile and a list of glyphnames and outputs their foreground; I called it
dmpfrgrnd.If I call
dmpfrgrnd MyriadPro-Regular.otf dotlessi iacute acuteI get the following output (with one point per line however)
dotlessi <Layer(cubic)
<Contour (161,0) on (73,0) on (73,484) on (161,484) on >
>
iacute <Layer(cubic)
<Contour (155,693) on (252,693) on (130,550) on (67,550) on >
<Contour (161,0) on (73,0) on (73,484) on (161,484) on >
>
acute <Layer(cubic)
<Contour (189,693) on (286,693) on (164,550) on (101,550) on >
>
Here it is easy to see that the
iacuteis obtained by "pasting" theacuteon top of thedotlessiand moving it(-34,0). As a consequence if the anchor for thedotelessiis at say(10,0)then the anchor for theacuteneeds to be at(44,0). The problem in this particular example is matching the countours. For some fonts, the contours for the diacritics are listed first, some other fonts last. Once you have matched the contours, it is easy to get the displacement.I don't know how far one can go with that. During my vacations, I generated an AAT font using anchors. Once I was done, I happily moved some diacritics to where they seemed to look better. I don't see why professionals (I am not one) would not do the same.
15 Jan 2012 — 5:33pm
Once you have matched the contours, it is easy to get the displacement.
I should have said "Once you have matched the contours, you have the displacement". Indeed, matching the contours means finding
(dx,dy)such that the contours corresponding to the diacritic in the precomposed glyph are obtained by adding(dx,dy)to all pairs in the contours of the glyph for the diacritic:(dx,dy)is the displacement.17 Jan 2012 — 2:06am
Everything you’ve said is of course right, Michel. Thanks for making it so explicit, this indeed clarified my thoughts a bit. I even ran quickly all those calculations by hand sketching out the deltas in a matrix for both vowels and diacritics and… well, there was no consistency for any given anchor pair I tried. Must have been no anchors and no luck for me.