[ncl-talk] Install custom font
Mary Haley
haley at ucar.edu
Thu Aug 16 09:50:51 MDT 2018
Hi David,
Unfortunately, it is a tedious process to add a new font to an existing
font table.
We've had questions about this through the years, and here's what one of
our original developers (now retired) responded with:
A complete description of the character (fontcap) tables,
including the character encodings, can be found at:
http://ncarg.ucar.edu/supplements/cgm_supp/cgm_supp.html
If you are wanting simply to add a character to an existing fontcap
defining filled fonts, then you would want to read the
"Character outline class" in the above.
Warning: you will have to be a particularly patient person to wade through
this to be successful.
As an exercise awhile back, this same developer added an umlaut "a" to a
font table to see what it took, and created a step-by-step document which
I've attached here. I also attached the resultant TIFF file of the
character he added. He said this process took him 2.5 hours for one
character, but that included the time it took to write the document.
Maybe this will be of help to someone. I would love to try this procedure
myself in my copious spare time. :-)
--Mary
On Wed, Aug 15, 2018 at 9:30 AM, David Hutchinson <
david.hutchinson at geo.su.se> wrote:
> Hi,
> I would like to install a custom font that is not pre-installed in the NCL
> font tables. Is it possible to do this using an .otf or .ttf file?
> Kind Regards,
> David
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180816/b7b4754d/attachment.html>
-------------- next part --------------
Notes on adding an umlauted "a" to the Helvetica font.
1.) I wrote an e-mail to myself with a single unmauted "a" in it. I
looked at the e-mail and changed the font size of the "a" to
max (this was 288 for the Lucida Grand font I was using).
2.) In looking at the large "a", I measured on the screen the height of
the character (13/8"), the space between the character and the
umlaut (2/8") and the height of the umlaut (2/8"). The space
between the two dots in the umlaut is 5/16". The width of each
dot in the umlaut is 2/8". The horizontal position of the
umlaut accent is centered over the horizontal coordinate
where the "a" achieves its maximum height. I will use
these proportions for the new umlauted "a" in the Helvetica font.
3.) The font encodings are described in the document:
http://ncarg.ucar.edu/supplements/cgm_supp/cgm_supp.html
4.) I went to $NCARG/common/src/fontcap and looked at the ASCII
fontcap for the Helvetica font (font21.fc). I went down and
looked at the encoding for the ASCII "a".
5.) Following the encoding descriptions contained in 2.), it is
seen that the final two numbers in the enumerated list for
the "a" are coordinates in the font coordinate system, the
coordinate system specified in the preamble to the fontcap.
Looking at those coordinates it is seen that the maximum
height of the "a" is 104 font coordinate units. Note that
the minimum is -4, since the "a" actually goes below the base
line. This is somewhat surprising, but accommodates for the
way that the human eye perceives characters.
6.) Using 104 for the height of the "a" and the proportions determined
in step 2., the space between the bottom of an umlaut and the
top of the "a" should be 16 coordinate units and the height of
the umlaut accent should also be 16 coordinate units. The
maximum height of the "a" occurs at horizontal coordinate 52.
The space between the two dots of the umlaut should be 20
font coordinate units.
7.) Summarizing the details in 6.) we need to define two dots
centered at horizontal coordinate 52 with height at the dot
bottom 120 (104+16), dot height and width 16, and the space
between the dots equal 20.
8.) Editing the ASCII fontcap in accordance with 7.) amounts to
adding two new regions, one for each dot. In the Helvetica
font dots are squares (look at the dot on a "j" for example).
In a font where a dot is not a square, it would be necessary to
add regions, the encodings of which could be obtained
by looking at the dot of a "j" in that font. For diacritical
marks other than an umlaut, try to build the accent from
existing regions in other characters.
9.) Finally, here is what we need to add to the Helvetica
fontcap. Actually, since there is no space for a new
character in the Helvetica font, a new font, such as
Helvetica-accents will have to be created to hold the
accented characters.
BEGIN_REGION
26 120
42 120
42 136
26 136
26 120
END_REGION
BEGIN_REGION
62 120
78 120
78 136
62 136
END_REGION
-------------- next part --------------
A non-text attachment was scrubbed...
Name: umlaut_a.tiff
Type: image/tiff
Size: 1270 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180816/b7b4754d/attachment.tiff>
More information about the ncl-talk
mailing list