LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Adding OpenType (OTF) fonts to X in Slackware 10.2 (http://www.linuxquestions.org/questions/slackware-14/adding-opentype-otf-fonts-to-x-in-slackware-10-2-a-437960/)

Yalla-One 04-23-2006 07:11 AM

Adding OpenType (OTF) fonts to X in Slackware 10.2
 
Running a stock slackware-current, I am trying to add my favorite OpenType (.OTF) fonts for use in X11 under Slackware.

I have the following relevant lines in my xorg.conf:
Code:

Section "Files"
RgbPath      "/usr/X11R6/lib/X11/rgb"
ModulePath  "/usr/X11R6/lib/modules"
FontPath    "/usr/X11R6/lib/X11/fonts/misc/"
FontPath    "/usr/X11R6/lib/X11/fonts/TTF/"
FontPath    "/usr/X11R6/lib/X11/fonts/OTF/"
FontPath    "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath    "/usr/X11R6/lib/X11/fonts/CID/"
FontPath    "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath    "/usr/X11R6/lib/X11/fonts/100dpi/"
FontPath    "/opt/openoffice.org/share/fonts/truetype/"
EndSection

Section "Module"
Load  "record"
Load  "extmod"
Load  "dbe"
Load  "dri"
Load  "glx"
Load  "xtrap"
Load  "freetype"
Load  "type1"
Load  "freetype"
Load  "synaptics"
EndSection

I then copied my .otf files into /usr/X11R6/lib/X11/fonts/OTF/ and ran fc-cache (as root), giving such a directory :

Code:

-rw-r--r-- 1 root root 62260 2003-06-12 15:26 PerpetuaStd.otf
-rw-r--r-- 1 root root 30492 2003-05-13 00:18 WeissStd.otf
-rw-r--r-- 1 root root  1161 2006-04-15 17:58 fonts.cache-1
-rw-r--r-- 1 root root    2 2006-04-15 17:52 fonts.dir

However, I don't get any OTF fonts, and my /var/log/Xorg.0.log gives these lines:

Code:

Could not init font path element /usr/X11R6/lib/X11/fonts/OTF/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
Could not init font path element /opt/openoffice.org/share/fonts/truetype/, removing from list!

Google told me I need to have type1 module loaded, but it is, and according to Xorg.0.log it is loaded without trouble. Have I missed any other modules or steps?

Any advise would be greatly appreciated!

-Y1

kodon 04-23-2006 01:55 PM

have you done
mkfontdir
and
mkfontscale
for the new dirs?

Yalla-One 04-23-2006 04:41 PM

Hi kodon,

Thanks much for your reply - I had not ran mkfontdir and mkfontscale, and I recently ran both as root. However, it still doesn't work and I get the same error message in Xorg.0.log..

However, now I also have a fonts.scale file:
Code:

8
PerpetuaStd.otf -adobe-perpetua std-medium-r-normal--0-0-0-0-p-0-iso10646-1
PerpetuaStd.otf -adobe-perpetua std-medium-r-normal--0-0-0-0-p-0-iso8859-1
PerpetuaStd.otf -adobe-perpetua std-medium-r-normal--0-0-0-0-p-0-iso8859-15
PerpetuaStd.otf -adobe-perpetua std-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
WeissStd.otf -adobe-weiss std-medium-r-normal--0-0-0-0-p-0-iso10646-1
WeissStd.otf -adobe-weiss std-medium-r-normal--0-0-0-0-p-0-iso8859-15
WeissStd.otf -adobe-weiss std-medium-r-normal--0-0-0-0-p-0-iso8859-1
WeissStd.otf -adobe-weiss std-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252

and a fonts.dir file with:
Code:

0
(single zero)

and fonts.cache-1 remains the same...

Could I be missing an X module (see table above) ?

-Y1

kodon 04-23-2006 05:14 PM

did you re-run `fc-cache -vv` (perhaps -f also)
after you made it a font directory?

Yalla-One 04-24-2006 02:02 AM

Thanks again!

Looks like my OTH directory isn't even cached...

Code:

/usr/X11R6/lib/X11/fonts/OTF#fc-cache -f -vv

fc-cache: "/usr/share/fonts": caching, 0 fonts, 1 dirs
fc-cache: "/usr/share/fonts/wine": caching, 0 fonts, 0 dirs
fc-cache: "/usr/X11R6/lib/X11/fonts/TTF": caching, 52 fonts, 0 dirs
fc-cache: "/usr/X11R6/lib/X11/fonts/Type1": caching, 29 fonts, 0 dirs
fc-cache: "/root/.fonts": skipping, no such directory
fc-cache: succeeded

I have added the path in /etc/X11/xorg.conf, remains unchanged:
Code:

Section "Files"
RgbPath      "/usr/X11R6/lib/X11/rgb"
ModulePath  "/usr/X11R6/lib/modules"
FontPath    "/usr/X11R6/lib/X11/fonts/misc/"
FontPath    "/usr/X11R6/lib/X11/fonts/TTF/"
FontPath    "/usr/X11R6/lib/X11/fonts/OTF/"
FontPath    "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath    "/usr/X11R6/lib/X11/fonts/CID/"
FontPath    "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath    "/usr/X11R6/lib/X11/fonts/100dpi/"
FontPath    "/opt/openoffice.org/share/fonts/truetype/"
EndSection

What could be the other reason why the OTF directory isn't scanned? (I'm running fc-cache as root, permissions not a problem (directory 755 and files 644)

Any other ideas?

kodon 04-24-2006 02:27 AM

try adding them to the font path...
`xset fp+ <dir>`
`xset fp rehash`

actually a mkfontdir in the parent
and a rehash should suffice.

Yalla-One 04-24-2006 03:30 AM

Still doesn't work, neither from superuser nor normal user (with xhost + for superuser)

However, one thing strikes me as odd - when I run fc-cache -vv, it lists fc-cache: "/usr/share/fonts/wine": skipping, 0 fonts, 0 dirs even though this directory is not listed in /etc/X11/xorg.conf

At the same time, the directories in /etc/X11/xorg.conf are not scanned - could I have a configuration inconsistency somewhere?

-Y1

kodon 04-24-2006 04:51 PM

hmm. i'm not sure why you would need to modify
xhost permissions. and this should all
be performed as root...

Yalla-One 04-25-2006 02:27 AM

Hi,

Reason why I had to do xhost +localhost was that xset uses X and thus requires authentication of some sort - as I _never_ login as root in X, it was needed.

However, I'm quite confident that the problem lies elsewhere, as the paths are correctly entered in /etc/X11/xorg.conf but still appear different in the logs and fc-cache -vv -f ...

Question: It would be interesting to know how many (if any?) have successfully installed OTF fonts in Slackware?

-Y1

gbonvehi 04-25-2006 02:53 AM

Take a look at /etc/fonts/fonts.conf, I added a file called /etc/fonts/local.conf which is included automatically by fonts.conf to support artwiz fonts, my file looks like:
Code:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf -->
<fontconfig>

        <dir>/usr/X11R6/lib/X11/fonts/artwiz</dir>

</fontconfig>


tomdkat 04-25-2006 02:57 AM

Quote:

Originally Posted by Yalla-One
Question: It would be interesting to know how many (if any?) have successfully installed OTF fonts in Slackware?

This isn't a Slackware specific issue, it's an X issue. :) According to Wikipedia, Freetype provides support for OTF. Do you have any TrueType fonts working on your system? It's late, so excuse stupid questions from me. :)

I noticed you have "freetype" specified twice in your X.org config file. Can you remove one of those and see if that changes anything? Where did you get your OTF fonts? If they can be downloaded, I can try one out on my system and see what happens. I'm running XFree86 4.6.0rc4, which isn't X.org but the freetype support should be the same. :)

Peace...

Yalla-One 04-25-2006 03:10 AM

Solved!
 
That did the trick! I removed the extra truetype load, and added the OTF directory to /etc/fonts/fonts.conf, and restarted X with Ctrl-Alt-backspace, and now my OTF fonts show up perfectly.

Thanks much to everyone involved - This is greatly appreciated!!

A couple of closing questions:

1. the /etc/fonts/fonts.conf file specifically says not to edit the file as it is automatically generated - does this mean I should really have changed something else?

2. In Windows, the more fonts you add, the slower the system runs, as it keeps a list of fonts in memory - I assume there's no equivalent issues in X, but would like to have confirmed that adding more fonts won't bloat/slow my system?

Thanks again - now I can finally get my templates working again :)

-Y1

tomdkat 04-25-2006 03:20 AM

Well, you changed two things so we're not sure which one fixed your problem. :)

Try adding the duplicate "freetype" module to your X.org config file and see if your problem comes back or not. Then we'll know for sure what the culprit was. :)

As for Windows fonts and performance issues, I've got over 1000 Windows fonts installed on my system and my system runs well.

The only time I see a performance "hit" is when I use an app that loads ALL the fonts so I can pick another font to use. The font loading time is very slow on my system but normal usage isn't impacted at all.

Peace...

Yalla-One 04-25-2006 06:41 AM

No change when dual freetype was added, but lost OTF when removed from fonts.conf so that's the culprit.

One interesting note though - while these fonts now show up when I do xlsfonts and also in Scribus and the KDE font program correctly, they are completely unreadable in OpenOffice.org 2.0(2). In the font list (they used to not appear at all), they are written in courier type themselves, and when I select the font, all text is less than 1 mm high and looks like fly droppings on the page.. This is not an issue in other apps than OpenOffice... Any ideas?

-Y1

tomdkat 04-25-2006 11:08 AM

Quote:

Originally Posted by Yalla-One
No change when dual freetype was added, but lost OTF when removed from fonts.conf so that's the culprit.

Now I better understand why my Windows fonts work. I installed them in the /usr/X11R6/lib/X11/fonts directory (in a sub-dir called Windows) which is already listed in /etc/fonts.conf so fc-cache knows to look there automagically when scanning for fonts to cache.

I have no idea on the OO issue.

Peace...


All times are GMT -5. The time now is 06:32 PM.