手動步驟

手動步驟

我的 dmenu 無法偵測到 noto 顏色表情符號字體。它可以檢測其他字體,但不能檢測此字體。怎麼解決這個問題呢?

➜ fc-list | grep -i "notocoloremoji"
/usr/share/fonts/truetype/noto/NotoColorEmoji.ttf: Noto Color Emoji:style=Regular
➜ dmenu -fn "Noto Color Emoji"
no fonts could be loaded.

答案1

一些糟糕的工具喜歡dmenu並使用一個名為處理字體渲染的st庫。libxft該庫有一個錯誤,導致它無法渲染彩色字體。幸運的是,這個bug其實已經被修復了,但由於某種原因尚未合併到上游。因此,要使彩色字體正常工作,您需要安裝此修補版本libxft,然後刪除手動停用彩色字體的檢查dmenu(由於此錯誤)。我已經在下面編寫了執行此操作的手動步驟,但作為更簡單的解決方案,您只需安裝此分支即可dmenu為您完成此操作:https://github.com/valeriangalliat/dmenumoji

手動步驟

在 arch linux 上,您可以使用此軟體包安裝修補版本libxft(取代舊版本):libxft-bgra。在其他發行版上,您需要下載 libxft 的源代碼,應用補丁,然後手動編譯並安裝修補版本的libxft。

獲得修補後的程式庫後,您需要編輯 dmenu 的原始程式碼以刪除已停用(先前損壞的)彩色字體的程式碼。該檢查位於頂部附近drw.c,如下所示:

    /* Do not allow using color fonts. This is a workaround for a BadLength
     * error from Xft with color glyphs. Modelled on the Xterm workaround. See
     * https://bugzilla.redhat.com/show_bug.cgi?id=1498269
     * https://lists.suckless.org/dev/1701/30932.html
     * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
     * and lots more all over the internet.
     */
    FcBool iscol;
    if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
        XftFontClose(drw->dpy, xfont);
        return NULL;
    }

刪除這段程式碼並重新編譯 dmenu,您將能夠使用彩色字體!這是一篇部落格文章

相關內容