Extension Request: Install arbitrary Truetype font

Forum: System
Topic: Extension Request: Install arbitrary Truetype font
started by: scot

Posted by scot on Dec. 13 2006,13:40
I think it would be great to have an extension which creates the control files and does postinstall for 'just any' Truetype font.  This way people could use whatever fonts they own under DSL.  Or as in my case, they could just use a single font which they really need.
My situation:
I'm trying to get the gvim text editor usable with one of the DejaVu fonts (free extensions on the Bitstream vera fonts, with the addition of a lot more glyphs).  I need a fairly obscure unicode range (Extended Greek) only available in very few monospaced fonts, and none of the microsoft ones.  I can get the right font (DejaVu Sans Mono) working under OpenOffice and GTK2 apps, but not under gvim, which I complied (including the unicode option for gtk1).  Would be find to rebuild vim for gtk2, but I haven't managed it yet.  It looks like the gtk2 devel lib has a lot of dependencies, so I expect to have some pain trying to install it with apt-get.

I have the full xfree86 loaded, and can manage to get dsl apps to see regular x-fonts (from, say the mydsl extensions)

I think I could be helped by any of these:

(1) If I could build the control files and get dsl apps to recognize the ttf fonts. (Hence the extension request)

(2) If I could get my system able to compile gtk2 apps, since the gtk2 apps extensions can all recognize my ttf fonts as they are.

(3) If I could somehow get a gvim binary compiled using gtk2 and the 'big' features option, which would work under dsl.

I do have ubuntu 6.06 installed as well, but the fonts.dir and fonts.scale files I created under it (for my dsl ~/.fonts directory)  don't seem to work) xset +fp /fontpath gives me an error "bad path or no fonts.dir, etc." I can give you the whole thing if you like.

Thanks for any advice.


Posted by ^thehatsrule^ on Dec. 13 2006,14:35
Add the FontPath to your xconfig
you may also possibly need to run fc-cache (or similar? again)

Use/update fontconfig and freetype?  Not sure what comes with the xf86 package...

Posted by mikshaw on Dec. 13 2006,15:03
I do have ubuntu 6.06 installed as well, but the fonts.dir and fonts.scale files I created under it (for my dsl ~/.fonts directory)  don't seem to work) xset +fp /fontpath gives me an error "bad path or no fonts.dir, etc."

You can create these files in DSL by running "mkfontdir" in the chosen directory...at least i think that command is part of Xfree

Posted by scot on Dec. 15 2006,10:36
Has anyone gotten 'just any' truetype font to work?  (aside, that is from the microsoft core fonts, which many seem to have been able to install with help from the post-install stuff in the related debian package?  I'd love to hear how you did it.  Especially if you are making use of wider unicode ranges.

It's true I didn't try adding the FontPath to my xconfig.  The standard advice on the forums was to use the xset +fp /fontpath, from the command line and later in .xinit, which I couldn't get to work.  I'll trying the FontPath route and see if I can do it.  I suspect, however that I haven't gotten the control files (fonts.dir, fonts.scale and whatever else is needed) to work yet.

I'm nearly positive that mkfontdir isn't included in DSL's XFree, but I'll check again.

Does anyone know about the control files for Truetype fonts?  Are they at all system dependant, or should I be able to create them under Ubuntu (for a given directory) and import them to DSL.  I thought that that should work, so I installed the package containing mkttfdir (or was it ttfmkdir?) to my Ububntu system and created some fonts.dir and fonts.scale files.  But still, they don't' work under DSL.

Thanks for any advice you have.

Posted by ^thehatsrule^ on Dec. 15 2006,15:23
Can you use the fonts under the dsl's default/gtk1 firefox?

I don't know if I used any ttf fonts, but theres many encodings and fonts available.  I was using freetype2 (w/ fontconfig) and it says it also supports ttf.  The fonts.dir stuff should be portable since it only contains data relevant to the usable stuff in that current dir, but you could always remake them to be sure.  Not that I tried gvim though (I'm a terminal+vim fan :P).  Perhaps you can statically compile the font (or use of) in.

Posted by scot on Dec. 22 2006,10:53
^thehatsrule^, No. the fonts are unusable under all gtk1 applications.  Did you have freetype2 running under DSL (with gtk1)?  I see that the freetype libs are in DSL, and they should support ttf, but I can't for the life of me get it all to work.  It seems I need a font server like xfstt (though the older forum discussion about installing microsoft's core fonts seemed to imply that it was possible to get them working with only stock DSL and the XFree86 extension.  No gtk2 needed, no added font servers.)  

The problem is still when I add a directory to the fontpath (xset +fp /fontdir), it gives me an error (see below) if I have truetype files in the directory.  I have created what I think are the necessary control files (fonts.dir and fonts.scale) under ubuntu.  I can add other fonts to my fontpath by the same method, but truetype fonts elude me.  

xset: bad font path element (#55), possible causes are:
 Directory does not exist or has wrong permissions
 Directory is missing fonts.dir
 Incorrect font server address or syntax

I've checked: the permissions and ownership (same as other added font dirs on my system which do work); fonts.dir (tried 2 different versions created with different utilities on Ubuntu);

Perhaps it's better if I repost in Other Help Topics, changing from an 'extension request' to a more general request for help with ttf's, including what I now know.  That's likely to have broader appeal I would think.

Thanks for your help so far.  I'll try to get xsftt working and repost if I'm still having trouble.

Posted by ^thehatsrule^ on Dec. 22 2006,15:03
I remember the ms fonts working, because I had to install them for some apps I was testing with wine to work properly - this was with the full xf86 extension.

Did you put the things in /fontdir then?

Haven't tried just using xfstt, and I don't know if I used any ttf fonts besides the ms ones.

Maybe the freetype2 in dsl does not have all the capabilities.  You could try updating it like I previously posted, and configure it how you'd like. But then, I was using xorg and I included all the default fonts (which is a lot) but I believe most of them were pcf, so what I'm talking about might not help you at all :P fyi, I installed fontconfig-2.2.3 and freetype-2.1.9 and had the FontPath set in xorg.conf (that would be XF86Config-4 in your case)

Posted by scot on Dec. 24 2006,23:41
Well I got xfstt working fairly well, but there was still no gold for me becuse (though other apps generally recognized the ttf fonts) my self-compiled version of gvim wouldn't make use of them.  But success came a different way.  It turns out that the newer versions of the "-misc-fixed-" group of pcf X-fonts have the unicode subset I need (extended Greek).  Your first post said they might, but I didn't think so, since I had already tried them out without success.  But my earlier tests were misleading me because I wasn't trying the fonts out on apps that could have properly handled unicode/utf-8 anyway.  And why would a mini distro include the characters for displaying a dialect of Greek that even the Greeks don't use anymore!  I couldn't believe it would.  How nice (and humiliating) to find out the solution was so close at hand (all the bits I needed, except vim compiled with 'big' options) were already included in the damn small distro out of te box.  Thanks for the help
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.