On Tue, Oct 16, 2018 at 7:48 PM Pablo Rodriguez wrote:
>
> I tried to experiment (modifying TeX Gyre Pagella from 1000 to
> UPM), but for some reason, I wasn’t able to load the font.
>
hm.
Weird.
Assuming ttx from fontools
$> ttx texgyrepagella-regular.otf
$> cp texgyrepagella-regular.ttx texgyrepagella-regular-500.ttx
$> cp texgyrepagella-regular.ttx texgyrepagella-regular-2000.ttx
Then we can edit the unitsPerEm tag:
texgyrepagella-regular-2000.ttx:
texgyrepagella-regular-500.ttx:
Also, better to edit the names too:
texgyrepagella-regular-2000.ttx:
texgyrepagella-regular-2000.ttx:
texgyrepagella-regular-2000.ttx:
texgyrepagella-regular-500.ttx:
texgyrepagella-regular-500.ttx:
texgyrepagella-regular-500.ttx:
texgyrepagella-regular.ttx:
texgyrepagella-regular.ttx:
texgyrepagella-regular.ttx:
Then recompile the font
$>ttx texgyrepagella-regular-500.ttx
$>ttx texgyrepagella-regular-2000.ttx
and the following examples with context:
%%% test-500-1000-2000.tex
\nopdfcompression
\usemodule[fnt-10]
\starttext
{\tfd file:texgyrepagella-regular-500.otf}
\ShowCompleteFont{file:texgyrepagella-regular-500.otf}{10pt}{1}
{\tfd file:texgyrepagella-regular.otf}
\ShowCompleteFont{file:texgyrepagella-regular.otf}{10pt}{1}
{\tfd file:texgyrepagella-regular-2000.otf}
\ShowCompleteFont{file:texgyrepagella-regular-2000.otf}{10pt}{1}
\stoptext
%%% test-hello-500-1000-2000.tex
\nopdfcompression
\definefont[TestD][file:texgyrepagella-regular-500.otf at 10bp]
\definefont[Test][file:texgyrepagella-regular.otf at 10bp]
\definefont[TestMM][file:texgyrepagella-regular-2000.otf at 10bp]
\starttext
\startTEXpage
{\TestD Hello 500}
{\Test Hello 1000}
{\TestMM Hello 2000}
\stopTEXpage
\stoptext
(yes, we have "10pt" vs "10bp")
You should see that the texgyrepagella-regular-500.otf is bigger than
texgyrepagella-regular.otf
and the texgyrepagella-regular-2000.otf is smaller than
texgyrepagella-regular.otf
This is ok: texgyrepagella-regular has unitsPerEm value="1000"
so changing *only* the unitsPerEm has an effect of scaling.
Consider the "M" :
$ grep 'name="M"' *ttx|grep mtx
texgyrepagella-regular-2000.ttx:
texgyrepagella-regular-500.ttx:
texgyrepagella-regular.ttx:
where "width" is the "advance width" in "font design units"
(it is the """ distance the current text position shall move (by
translating text space) when the glyph is painted. """ , see the pdf
reference).
So in texgyrepagella-regular.ttx, M has a "width" of 946 on 1000
units,
in texgyrepagella-regular-500.ttx, M has a "width" of 946 on 500 that
looks like 2x the width of M in regular
in texgyrepagella-regular-2000.ttx, M has a "width" of 946 on 2000 that
looks like 0.5x the width of M in regular
--- under the assumption that we have changes *only* the value of
unitsPerEm.
unitsPerEm is a number that says that, well, "1em is made by
values":
it is a dimensionless unit that defines a "glyph space of (x,y) real
coordinates " ( not arbitrarily, there are implementation limits to respect
).
So, in principle we can say "Let's start to design a font in a grid
1000x1000 of font design units" as well
"Let's start to design a font in a grid of 2048x2048 units".
In any case, at some point we have to translate these numbers from the
dimensionless "glyph space" to a dimensional "text space"
and this is done by the FontMatrix --- another set of numbers that we can
choose arbitrarily, at least apparently.
Given an unitsPerEm=1000, if we choose a FontMatrix = [ 0.001 0 0 0.001 0
0 ]
then, for both horizontal and vertical dimensions, 1000 units in a "glyph
space" are 1000*0.001 = 1 Postscript point in the "text space":
i.e 1000 units => 1 Postscript point = 1/72 inch ~ 0.0003528 m (1
Postscript point is 1bp in TeX and it's not exactly the same of 1pt).
When an application loads a font to typeset some text
it has to specify the size of the glyph in a dimensional unit , because in
the end everything must be rasterized on a physical device
-- screen or paper -- to be viewed .
In TeX, by saying "at 10pt" we mean "for this font, multiply every
dimension in "text space" by 9.9626401"
(10pt are 9.9626401bp , ie 9.9626401 Postscript points).
The font designer should then explicitly says (in some doc) something like
"this font is for reading at 10pt"
or "this is for title at 18pt" or something similar (of course he means
Postscript points, not TeX points)
and from here we can have an idea of "design size" of the font.
So, if we have 1000 unitsPerEm,
a FontMatrix = [ 0.001 0 0 0.001 0 0 ],
and we choose 10bp for the actual text,
1000 units are 10bp, or 1em = 10bp
In the previous experiments we have left unchanged the FontMatrix:
texgyrepagella-regular-2000.ttx:
texgyrepagella-regular-500.ttx:
texgyrepagella-regular.ttx:
as well as all the other dimensions.
In texgyrepagella-regular-500.ttx we have 500 unitsPerEm and hence
500 units in a "glyph space"