View previous topic :: View next topic |
Author |
Message |
aCOSwt Bodhisattva
Joined: 19 Oct 2007 Posts: 2537 Location: Hilbert space
|
Posted: Mon Feb 07, 2011 1:15 pm Post subject: Using third-party true type fonts |
|
|
Version 0
I ABSTRACT
Using third-party fonts (fonts that are not available under portage's media-fonts category) is theoretically a piece of cake. It can even be summarized into a single shell command line... :
- Copy your font files under your /usr/local/share/fonts directory tree. Period !
One might want to additionally understand how this works, tweak some fancy features, have a less system-wide installation, declare font's substitutions... all this is already well explained under a nice gentoo-wiki : http://en.gentoo-wiki.com/wiki/X.Org/Fonts
Apart from a kind BoneKracker request https://forums.gentoo.org/viewtopic-t-863273-highlight-.html there should be no need for extra writings on this subject... However... there actually is indeed !
After having carefully installed your font files, and, providing you actually need them... you will notice that some of them, including several well known, widely used and professional fonts are simply... ignored by your favorite apps including OpenOffice, Inkscape...
The purpose of this thread is to make these fonts available to these applications.
II WHY AREN'T THESE FONTS AVAILABLE
There can certainly be many reasons for this but there are two major reasons we will deal with :
II.1/ Your favorite app is... broken ! (Yes it is !)
Many apps (The Gimp being a noticeable exception) were designed in the good old times when assumption was made that, for a given font family, (Let's say Arial for example) you could have only four different faces (sub-families) : Regular, Bold, Italic, Bold-Italic.
These apps group fonts by family names, only family names are suggested in the application's drop-down lists and the desired sub-family is selected by a combination of the B and I buttons => 4 different possible states maximum !
The problem is that the OpenType specification offered many more possible sub-families and font forgers jumped on the opportunity.
To stay with the Arial family, you can find more than twenty sub-families Black, Black-Italic, Narrow, Narrow-Bold...
Many apps cannot offer access to them !
II.2/ Your font is broken ! (Yes it can be and "It works under my MICROS~1" is not a proof of the contrary )
Hundreds of files, among which topquality-expensive fonts elder than the OpenSpec, nice-copyrightfree fonts created taking considerably greater care of the design than... of the metadata..., just do not comply with OpenSpec
And, if MICROS~1 font management system relies on some unpredictable algorithms to (sometimes successfully... ) workaround this, our dear fontconfig does not and... does not intend to
Fontconfig conforms to OpenSpec when an application requests the font-naming metadata. If appropriate fields are not filled in (old fonts) or filled with fancy non-specification-compliant names... then... Bad Luck !
III WORKING AROUND
III.1 WARNING
We are going to alter the font files. So... As usual... depending on your country, copyright notices, conditions of use, colour of the sun, heat of the stars... you... might or might not have the rights to such fiddling.
So... as usual... do spend your time ensuring that you are entitled to proceed rather than really proceeding
III.2 Get the appropriate software
The workaround I suggest is based on the rewriting of the font-naming meta data.
This can easily be done thanks to media-gfx/fontforge
BTW, this is a great package indeed that would deserve far more attention and interest than the restricted use we are going to make of it suggests.
If it is not already done, just emerge it with default use flags.
Because I use it for other purposes, I personally emerged Code: | media-gfx/fontforge-20100501 USE="X cairo -cjk -debug -doc gif jpeg nls pango pasteafter png python svg tiff tilepath truetype truetype-debugger -type3 unicode" |
III.3 Access to the font-naming metadata
- 1 Launch fontforge
- 2 From the application menu, select File then Open
- 3 Select the font file (.ttf) you want to modify from the file chooser.
- 4 Step 3 should lead to the display of glyphs in one window and eventually open a warning window listing errors. You can safely ignore the latter.
- 5 From the Main fontforge window's menu, select Element then Font Info
- 6 Step 5 should lead to the display of a new window with a vertical menu on the left hand side.
- 7 Within this window, select TTF Names, this should lead to the display of a three columns (language / String Id / String) table.
III.4 Solving Problem II.1
The workaround for problem II.1 consists in breaking the link between a given sub-family font and it's original family, making this font a new sub-family of a new family.
BTW, I got this idea looking how media-fonts/corefonts guys had managed to make the Arial Black available to applications while the Arial Black you would ste... borrow from some MICROS~1 >=XP distribution would not be made available to your applications. => Full credits to them.
Let's apply this to the most widespread and archetypal example of problem II.1 : Arial Narrow
Arial Narrow are originally four sub-families of the Arial family :
- A Narrow-Regular (Filename arialn.ttf)
- B Narrow-Bold (Filename arialnb.ttf)
- C Narrow-Italic (Filename arialni.ttf)
- D Narrow-Bold-Italic (Filename arialnbi.ttf)
We are here going to create a new family named Arial Narrow (Having no longer to do with the Arial family) composed of the four traditional subfamilies : Regular, Bold, Italic and Bold Italic. => (Cont. from III.3)
- 8 Find in the table the line which String Id matches Preferred Family, click on the corresponding String cell. (Which originally shows Arial)
- 9 Edit the field changing Arial to Arial Narrow
- 10 Find in the table the line which String Id matches Preferred Styles, click on the corresponding String cell.
- 11 Edit the field changing whatever there is to, depending on the file you are editing :
-A Regular
-B Bold
-C Italic
-D Bold Italic
-12 Close the Info Window you are on by clicking [OK]
-13 Jump to III.6 in order to save your work. (Not as simple as File -> Save of course... )
Of course, you do not need to have the four sub-families available. Coming back to the Arial Black example, one would just need to create the Regular sub family.
III.5/ Solving Problem II.2
If the trouble you are facing falls into this category, then... you just get no other way that parsing the entire table (and possibly others from the left hand side list) checking that necessary definitions exist and are made in accordance with specs !
This part is... vast and... I will develop if interest is shown for it.
In the mean time, one can fruitfully refer to this document http://www.microsoft.com/typography/otspec/name.htm
III.6/ Save your new font
Take care that your font needs to be rebuilt in order to take into account your modifications :
-14 From the FontForge main window's menu, select File then Generate Fonts A new dialog box shows.
-15 Click in the drop down list immediatly under the filename field and select True Type
-16 Choose the filename (Take the original one / Keep the one automatically suggested by FontForge / Choose Whatever...)
(Take care that as you are likely to be running FontForge as a non-root user => you might not get the rights to save your file directly under the /usr/local/share/fonts tree... )
-17 Click on the Save button. Depending on the quality of your font, FontForge may output miscellaneous errors. Providing you did not mess anything else that what we discussed here... you should safely ignore them.
Well... If this can help.
Please do not hesitate to enhance / correct... even on the language side... |
|
Back to top |
|
|
Bones McCracker Veteran
Joined: 14 Mar 2006 Posts: 1611 Location: U.S.A.
|
Posted: Mon Feb 07, 2011 11:20 pm Post subject: |
|
|
Good stuff here! Thanks a lot, aCOSwt! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|