如何在UFO 3中使用组合字符?附Unicode私用区示例需求
Hey there! Let's figure out how to make your U+E000 and U+E001 characters overlay when typed in sequence using UFO3. The core of this is setting up ligature substitution via OpenType features, paired with component-based glyphs to keep your workflow clean. Here's a step-by-step breakdown with concrete examples you can copy-paste and adapt:
1. Set Up Your Glyph Files
First, you'll need three glyphs in your UFO's glyphs folder:
uniE000: Your base character (the bottom layer)uniE001: The overlay character (sits on top of the base)uniE000_uniE001: The combined ligature that shows both stacked
For the ligature glyph, use components to reference your base and overlay—this way you don't have to redraw them, and any edits to the base glyphs will automatically update the ligature. Here's what uniE000_uniE001.glif should look like:
<?xml version="1.0" encoding="UTF-8"?> <glyph name="uniE000_uniE001" format="2"> <advance width="200"/> <!-- Match the advance width of your uniE000 glyph --> <outline> <component base="uniE000"/> <!-- Adjust xOffset/yOffset here if you need to nudge the overlay into perfect position --> <component base="uniE001" xOffset="0" yOffset="0"/> </outline> </glyph>
Don't forget to set the Unicode mappings for your base glyphs. In uniE000.glif, add:
<glyph name="uniE000" format="2"> <unicode hex="E000"/> <!-- Add your advance width, outline paths, etc. here --> </glyph>
And do the same for uniE001.glif with <unicode hex="E001"/>. The ligature glyph doesn't need a Unicode mapping—it's only used as a replacement for the character sequence.
2. Add the Ligature Feature
Next, you need to tell the font to replace the sequence U+E000 U+E001 with your ligature glyph. Open (or create) the features.fea file in your UFO's root directory, and add this OpenType feature code:
feature liga { lookup overlayLigature { sub uniE000 uniE001 by uniE000_uniE001; } overlayLigature; } liga;
We're using the standard liga (ligature) feature here because it's widely supported across text rendering engines. If you wanted a custom feature, you could define one, but liga is the safest bet for broad compatibility.
3. Generate and Test
Once you've got these files set up, generate your font using a tool like RoboFont, FontLab, or fontmake (a command-line tool for building fonts from UFOs). Then test it in a text editor that supports ligatures—make sure ligature support is enabled in the editor's settings! When you type U+E000 followed by U+E001, the pair should be replaced with your overlayed ligature.
Quick Tips:
- If the overlay isn't positioned perfectly, go back to the ligature's
.gliffile and adjust thexOffset/yOffsetvalues for theuniE001component. - If you have more overlay pairs to add, just duplicate the
subline in theligafeature block (e.g.,sub uniE002 uniE003 by uniE002_uniE003;). - Some apps might require you to explicitly enable ligatures (like Adobe InDesign's "Standard Ligatures" toggle), so double-check that if you're not seeing the behavior.
内容的提问来源于stack exchange,提问作者鈴木雪

