彩色法式装饰的妙用

彩色法式装饰的妙用

我将此字体文件保存为示例:

-- file pagella.lfg
return {
    name = "pagella",
    comment = "Goodies that complement pagella.",
    colorschemes = {
        default = {
            [1] = {
                0x0301, 0x0300, 0x0302, 0x0308, 0x0323,
            },
        },
    },
}

获得彩色的强调。

但我没有结果。缺少什么?

\input pagella.lfg
\mainlanguage[fr]
\setupcolors[state=start]
\definefontfeature
  [pagella]
  [goodies=pagella,
   colorscheme=default,
  ,protrusion=quality,expansion=quality] 
\definecolor[colorscheme:1:1][r=1,g=0.3]


%%%%%%%%%%%%
\starttext
%%%%%%%%%%%%

Un texte avant, non coloré.

\setfontcolorscheme [1]    élève  pâtes gîte site

\stoptext

答案1

您需要做的有点棘手,因为 ConTeXt 处理的是预组合字符。解决方案是手动将重音字符拆分为非重音字符,然后组合变音符号(Unicode 范围 0300–036F)以下是您可以在 ConTeXt 中定义的其他类型的特征的列表.然后你对标记进行颜色组合以获得所需的效果。

顺便说一句,我刚刚考虑了一些小写字母的随机示例。您可以自行扩展要转换的字符列表。

注意事项:关于i:当包含此字母的大小写时,请改用无点形式ı(U+0131)。否则,您的变音符号将被错误放置。另外,我没有包含,i因为它会弄乱连字,如fiffi,但没有什么可以阻止您这样做(但请不要这样做)。

--Save this in the same folder as your main file
--coloredaccents.lfg
return {
    name = "coloredaccents",
    version = "2021/02/09",
    comment = "Colored accents for French",
    author  = "Jairo A. del Rio",
    colorschemes = {
        default = {
            { "0x0300:0x036F" }, -- Combining Diacritical Marks
        }
    }
}
%%%For testing only
\setuppapersize[A6,landscape]
%%%
\mainlanguage[fr]
\setupbodyfont[pagella]
\startluacode
    fonts.handlers.otf.addfeature {
        name = "coloredaccents",
        type = "multiple",
        data = {
                    ["à"] = {"a","̀"},
                    ["â"] = {"a","̂"},
                    ["è"] = {"e","̀"},
                    ["é"] = {"e","́"},
                    ["ê"] = {"e","̂"},
                    ["ë"] = {"e","̈"},
                    ["î"] = {"ı","̂"},
                    ["ï"] = {"ı","̈"},
                    ["ô"] = {"o","̂"},
                    ["ö"] = {"o","̈"},
                    ["ù"] = {"u","̀"},
                    ["û"] = {"u","̂"},
                    ["ü"] = {"u","̈"},
                    --Add more if required
        }
    }
\stopluacode
\definefontfeature[coloredaccents][default]
    [coloredaccents=yes,goodies=coloredaccents,colorscheme=default]
\definecolor[colorscheme:1:1][r=1,g=0.3]
%%%Remove "@30pt" for a normal font size
\definefont[nice][Serif*coloredaccents @ 30pt]
%%%
\starttext
\setfontcolorscheme[1]%
{\nice
planète écouter à où 

château fête côté sûr 

dîner naïve Noël

%I know Göttingen is German, but it looks cool here.
Archélaüs Göttingen}
\stoptext

在此处输入图片描述

相关内容