Open the PasteCharm font generator’s text editor. Paste é and é one at a time, and check the Bold card after each. The first input stays unchanged. With the second, PasteCharm replaces the e with its bold Unicode equivalent and keeps the accent. You can click Copy on the card and inspect the output with the console snippet below.
This comes up when you style a name for a profile bio. Two copies of the same name can contain different Unicode sequences, depending on how they were entered.
Colin Barnes pointed out the edge case in a comment on my post about missing glyphs. The example in that post used one spelling of é. Here's what happens when we test both.
Print the code points
This is the relevant part of the mapper reduced to one letter. Run it in a browser console or a recent Node.js version. Printing code points makes the difference visible even if your font draws the two inputs the same way.
const samples = ['\u00E9', 'e\u0301', '👩💻'];
const bold = new Map([['e', '\u{1D41E}']]);
function style(text) {
return Array.from(text, char => bold.get(char) ?? char).join('');
}
function codePoints(text) {
return Array.from(text, char =>
'U+' + char.codePointAt(0).toString(16).toUpperCase().padStart(4, '0')
).join(' ');
}
for (const text of samples) {
console.log(codePoints(text) + ' → ' + codePoints(style(text)));
}
// U+00E9 → U+00E9
// U+0065 U+0301 → U+1D41E U+0301
// U+1F469 U+200D U+1F4BB → U+1F469 U+200D U+1F4BB
To check what you copied from the Bold card, paste it between the quotes in codePoints("") and run that line in the same console.
The first string has one code point. The second has an ASCII e followed by a combining acute accent. Array.from() hands each code point to the mapper separately, so the e matches the table. The accent passes through. The emoji also passes through because none of its code points matches the table.
Counting and styling ask different questions
PasteCharm uses Intl.Segmenter for its editor counter when the browser supports it. Both spellings of é count as one grapheme cluster, as does the emoji above. But the Bold mapper still works one code point at a time. A counter test can pass while the conversion treats two spellings differently. ECMAScript specification for Intl.Segmenter
For these two spellings, running .normalize('NFC') before the lookup would make both inputs map from U+00E9. That would leave both unstyled with this table. Some combining sequences have no single precomposed form, so NFC alone does not make code-point substitution preserve every accent sequence. Unicode Normalization Forms
If the product rule is to keep accented text untouched, another option is to segment the input and only replace whole clusters that match the style table. That preserves a base letter and its accent together even when the base letter would have matched on its own. It's an option for a future change. The output above shows the current mapper.
The test I'd keep is the pair of inputs that looks identical. Assert their code points before and after styling. Then test the counter separately. A screenshot of two é characters tells you very little about which path your code took.
This article was drafted with AI from PasteCharm’s implementation and verified examples.
Top comments (0)