mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-06-22 04:11:55 +10:00
Problem in word wrapping in the templates (#3136)
Co-authored-by: santino cantale <sopor@ARBA-TSM-WS020.tsm.local>
This commit is contained in:
@@ -156,24 +156,8 @@ describe("registerFonts", () => {
|
||||
|
||||
const hyphenationCallback = registerHyphenationSpy.mock.calls.at(-1)?.[0];
|
||||
expect(hyphenationCallback?.("翠翠红红处处")).toEqual(["翠", "", "翠", "", "红", "", "红", "", "处", "", "处", ""]);
|
||||
expect(hyphenationCallback?.("Reactive")).toEqual([
|
||||
"R",
|
||||
"",
|
||||
"e",
|
||||
"",
|
||||
"a",
|
||||
"",
|
||||
"c",
|
||||
"",
|
||||
"t",
|
||||
"",
|
||||
"i",
|
||||
"",
|
||||
"v",
|
||||
"",
|
||||
"e",
|
||||
"",
|
||||
]);
|
||||
// Latin words must stay intact even in CJK mode — no character-level breaking.
|
||||
expect(hyphenationCallback?.("Reactive")).toEqual(["Reactive"]);
|
||||
});
|
||||
|
||||
it("returns typography with font weights sorted ascending", async () => {
|
||||
|
||||
@@ -163,7 +163,11 @@ export const registerFonts = (typography: Typography, locale: Locale, hasCjkCont
|
||||
Font.registerHyphenationCallback((word) => {
|
||||
if (needsCjkTextSupport) {
|
||||
if (word === " ") return ["\u200C "];
|
||||
return [...word].flatMap((l) => [l, ""]);
|
||||
// Only break at every character for words that contain CJK characters.
|
||||
// Latin/non-CJK words must stay intact even in a CJK-locale resume.
|
||||
if (cjkLetterRegex.test(word)) {
|
||||
return [...word].flatMap((l) => [l, ""]);
|
||||
}
|
||||
}
|
||||
|
||||
return [word];
|
||||
|
||||
Reference in New Issue
Block a user