Platform independent way to get font directory?

后端 未结 2 1836
礼貌的吻别
礼貌的吻别 2020-12-16 04:28

Is there a way I could find where fonts are stored on either Windows, OSX, or Linux? If not, is there a way I can guarantee certain paths (such as X:/Windows/Fonts/) for all

2条回答
  •  萌比男神i
    2020-12-16 05:10

    That's assuming the target OS has a font folder. For example, it's quite feasible for a Linux installation to be console-only and not have a font directory at all.

    Anyways, my best guess is that there is no platform independent way. You can write your own platform independent function, but within it will have to check the current OS (via some IFDEF's, I cannot say what) and then call the right function. But again - I wouldn't be so sure you can obtain it under Linux at all.

提交回复
热议问题