V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
aboutcxj
V2EX  ›  程序员

[Mac OS]如何不安装字体到系统,但是在其他软件中可以使用字体?

  •  
  •   aboutcxj · Sep 21, 2020 · 2105 views
    This topic created in 2054 days ago, the information mentioned may be changed or developed.

    最近公司要开发个字体的软件,

    • 1 、不安装字体到系统的字体册;
    • 2 、在我们的软件中激活某字体后,在 ps 或其他软件中可以使用该字体;
    • 3 、在 ps 中选中文字图层,在我们的软件中点击某一款字体,能把字体效果应用到 ps 中选中的图层。

    目前了解到 [字由] 这款软件能实现上面的功能, https://www.hellofont.cn/download

    字由效果: https://streamja.com/Onl9b

    目前发现字有在系统中安装了 2 个插件 https://i.postimg.cc/bvHX5tcr/STIIITCH-2020-09-21-12-03-14.png

    我是个 iOS 开发,没接触过 Mac 开发,有没有人有这方便的思路可以参考下呢?

    8 replies    2020-10-20 17:40:43 +08:00
    GM
        1
    GM  
       Sep 21, 2020
    反编译一下就知道了
    GM
        2
    GM  
       Sep 21, 2020
    准确来说,逆向一下
    aboutcxj
        3
    aboutcxj  
    OP
       Sep 21, 2020
    @GM 不懂反编译,哈哈哈哈
    jearyvon
        4
    jearyvon  
       Sep 21, 2020
    把字体下载到临时目录,然后使用系统相关 API 激活字体注册到系统 https://developer.apple.com/library/archive/documentation/StringsTextFonts/Conceptual/CoreText_Programming/Introduction/Introduction.html#//apple_ref/doc/uid/TP40005533
    然后调用自动化脚本设置字体就好了。
    aboutcxj
        5
    aboutcxj  
    OP
       Sep 22, 2020
    @jearyvon 请问是使用 CTFontManagerRegisterGraphicsFont 注册吗?
    我注册后在当前 app 能看到,,但是其他 app 看不到。
    aboutcxj
        6
    aboutcxj  
    OP
       Sep 22, 2020
    @jearyvon 找到了,,谢谢
    aboutcxj
        7
    aboutcxj  
    OP
       Sep 22, 2020
    @jearyvon 请问下自动化脚本设置其他软件的字体,有没有相关的文档呢
    jearyvon
        8
    jearyvon  
       Oct 20, 2020
    @aboutcxj 直接往~/Library/Fonts/下写入字体文件 所有 app 都能用。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3839 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 10:35 · PVG 18:35 · LAX 03:35 · JFK 06:35
    ♥ Do have faith in what you're doing.