LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Font Permissions (https://www.linuxquestions.org/questions/linux-newbie-8/font-permissions-4175555368/)

chris319 10-05-2015 07:29 PM

Font Permissions
 
Hello -

In Linux Mint I have installed some new fonts in the usr/share/truetype folder. To make them visible to my non-root account, in permissions I have set the Group to my user account name, e.g. "myAccount" and ran fc-cache. All works well.

My question is, what if I wanted more user accounts to be able to use these fonts than just the one I have selected in "Group"? I don't see an entry for "All Users".

Thank you.

HMW 10-06-2015 01:50 AM

Hi there!

I dont know how to do it using the GUI in Linux Mint, but from a command line, you can give everybody ('o' = others) the right to read a file or a directory with:
Code:

chmod o+r /path/to/file
For example. Consider this file:
Code:

-rw-r-----  1 HMW  staff      0  6 Okt 08:46 foobar
User has read & write (rw) permissions and group has read (r) permission. To allow everybody to read, issue this:
Code:

chmod o+r foobar
And now...
Code:

-rw-r--r--  1 HMW  staff      0  6 Okt 08:46 foobar
Best regards,
HMW

vincix 10-06-2015 01:51 AM

By default, fonts in linux mint are located in /usr/share/fonts. I'm not sure if it was just a mistake or if that's where you actually installed the new fonts, but normally it should have been /usr/share/fonts/truetype. Also by default fonts have 755 and are owned by root:root. So that means that every user on the system can use the fonts - that's the default behaviour.

So what do you want to do exactly? Do you want to actually restrict the access of some users to certain fonts or do you want the fonts to be accessible by anyone?

Did you specify the font location when you ran fc-cache?

chris319 10-06-2015 03:22 AM

Thanks for the replies.

I have imported several fonts from my Windows HD and had to change the permissions for Linux.

In the gui you simply set the group to "root" and other users will be able to see them. If there were more accounts on this machine than me and root, I would want them all to be able to see the fonts. Now I have Times Roman (Arial they can keep). I am a big fan of legacy typefaces.

I ran

sudo fc-cache -fv

and it seems to find everything OK. The fonts show up in the font viewer, etc.

vincix 10-06-2015 06:24 AM

Quote:

Originally Posted by chris319 (Post 5430599)
Thanks for the replies.

I have imported several fonts from my Windows HD and had to change the permissions for Linux.

In the gui you simply set the group to "root" and other users will be able to see them. If there were more accounts on this machine than me and root, I would want them all to be able to see the fonts. Now I have Times Roman (Arial they can keep). I am a big fan of legacy typefaces.

I ran

sudo fc-cache -fv

and it seems to find everything OK. The fonts show up in the font viewer, etc.

I doubt that setting the group to root allows other users to see them. In my opinion, it's the permissions that you give to others. As I was saying, by default the permissions are 755 with root as owner and group. So normally if you place them under /usr/share/fonts and try chown -R /usr/share/fonts/truetype and chmod -R 755 /usr/share/fonts/truetype and then run fc-cache, it should be fine - that is if you don't want to reboot instead of fc-cache.

DavidMcCann 10-06-2015 11:43 AM

On my system, the fonts folders are owned by root, with read-only access for others. I expect Mint is the same. Anything put in them (using sudo in your case) will inherit those permissions, which is exactly what you need. You didn't need to touch the group setting.

vincix 10-06-2015 12:30 PM

Quote:

Originally Posted by DavidMcCann (Post 5430789)
On my system, the fonts folders are owned by root, with read-only access for others. I expect Mint is the same. Anything put in them (using sudo in your case) will inherit those permissions, which is exactly what you need. You didn't need to touch the group setting.

Yes, you're right. So indeed, no need for chown or chmod. Just place them there.

DavidMcCann 10-07-2015 10:16 AM

You can also put fonts for a specific user in $HOME/.fonts which saves using su/sudo and works fine for a single-user computer.

jpollard 10-07-2015 11:50 AM

Just a small nit - I'm not sure the licence for Windows includes allowing the fonts to be used under a Linux distribution.

chris319 10-07-2015 02:02 PM

Quote:

Originally Posted by jpollard (Post 5431310)
Just a small nit - I'm not sure the licence for Windows includes allowing the fonts to be used under a Linux distribution.

It's a moot issue if the fonts were obtained from a third party.

jpollard 10-07-2015 04:17 PM

Quote:

Originally Posted by chris319 (Post 5431369)
It's a moot issue if the fonts were obtained from a third party.

Microsoft wouldn't think so.

The fonts were reported to come from a Microsoft system. And those do come with truetype fonts... or at least did when I knew of them.

Now if the fonts came from someone else then they wouldn't have come from a Microsoft system.

That was why I said "small nit".

vincix 10-08-2015 02:49 AM

Not trying to contradict anyone, but I'm trying to imagine the funny scenario where some people (don't know who regulates this stuff, anyway) came into your company and looked for unlicensed fonts on your linux system!

jpollard 10-08-2015 05:54 AM

Quote:

Originally Posted by vincix (Post 5431616)
Not trying to contradict anyone, but I'm trying to imagine the funny scenario where some people (don't know who regulates this stuff, anyway) came into your company and looked for unlicensed fonts on your linux system!

Both Microsoft and the BSA have been known to disrupt companies with "license validation" searches. In the past, both have also called a Linux system "unlicensed" and improper.

The only sure way to prevent them is to be able to say "no Microsoft here".

https://www.microsoft.com/typography/faq/faq11.htm

chris319 10-09-2015 07:02 AM

I'm looking at the fonts directly from a Windows 7 installation and see the following copyright information for various fonts:

Arial, Times New Roman, Courier New, Impact: The Monotype Corporation

Georgia, Trebuchet MS, Tahoma, Tahoma, Calibri, Comic Sans MS: Microsoft

Lucida Console: Bigelow & Holmes

Quote:

Most of the fonts supplied with Microsoft products have been licensed from leading type foundries. In most cases Microsoft does not have the right to sublicense them.

tronayne 10-09-2015 07:52 AM

Do you have a /etc/fonts directory that contains ./ ../ conf.avail/ conf.d/ fonts.conf fonts.dtd?

If so, you should create a file, local.conf, in that directory of the form:
Code:

cat local.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->
<fontconfig>
        <dir>/usr/local/share/fonts/Adobe</dir>
        <dir>/usr/local/share/fonts/MSfonts</dir>
        <dir>/usr/local/share/fonts/myfonts</dir>
        <dir>/usr/local/share/fonts/Interstate</dir>
</fontconfig>

where the fonts you have added should be in separate directories as shown (and should also be in /usr/local/share/fonts rather than in your system directories -- keeps things neater).

In each of your font directories; e.g., /usr/local/share/fonts/MSfonts, you need to execute two commands:
Code:

su -    <become root>
mkfontscale

then
Code:

mkfontdir
From the manual page for mkfontdir:
Quote:

For each directory argument, mkfontdir reads all of the font files in the directory
searching for properties named "FONT", or (failing that) the name of the file
stripped of its suffix. These are converted to lower case and used as font names,
and, along with the name of the font file, are written out to the file "fonts.dir"
in the directory. The X server and font server use "fonts.dir" to find font files.

The kinds of font files read by mkfontdir depend on configuration parameters, but
typically include PCF (suffix ".pcf"), SNF (suffix ".snf") and BDF (suffix ".bdf").
If a font exists in multiple formats, mkfontdir will first choose PCF, then SNF and
finally BDF.

The first line of fonts.dir gives the number of fonts in the file. The remaining
lines list the fonts themselves, one per line, in two fields. First is the name of
the font file, followed by a space and the name of the font.
In my case, those font directories contain collections of fonts (MSfonts, for example, contains TTF files, Adobe contains the Adobe Type Library, and so on). You you don't really want to mix fonts of different types in the same directory -- won't hurt, but won't help either, keep 'em the same type).

Doing the above will make all fonts available to all applications for all users without any fooling around. The directories and files are owned by root and group root.

To make them available, you need to execute (once) as root
Code:

su -
/usr/bin/fc-cache -f

You do not need to do that again because there should be in your boot sequence that command; what it does is update X font indexes. You do it manually one time after you've done the above just to see if it's working.

Now all this depends on the existence of /etc/fonts -- if you don't have that, you're stuck with the really old fashioned way, sorry.

If you copy MS fonts to your Linux system, well, that's up to you.

Hope this helps some.


All times are GMT -5. The time now is 02:01 AM.