mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-17 15:24:19 +00:00
fix(cli): measure Greek and Lithuanian painted casing
This commit is contained in:
@@ -486,11 +486,11 @@
|
||||
if (!context) return null;
|
||||
context.font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;
|
||||
let text = textContentFor(element, true);
|
||||
const turkic = element.matches(":lang(tr), :lang(az)");
|
||||
const casing = ["tr", "az", "el", "lt"].find((lang) => element.matches(`:lang(${lang})`));
|
||||
if (style.textTransform === "uppercase")
|
||||
text = turkic ? text.toLocaleUpperCase("tr") : text.toUpperCase();
|
||||
text = casing ? text.toLocaleUpperCase(casing) : text.toUpperCase();
|
||||
if (style.textTransform === "lowercase")
|
||||
text = turkic ? text.toLocaleLowerCase("tr") : text.toLowerCase();
|
||||
text = casing ? text.toLocaleLowerCase(casing) : text.toLowerCase();
|
||||
if (style.textTransform === "capitalize") text = capitalizeWords(text);
|
||||
const metrics = context.measureText(text);
|
||||
return metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent > 0 ? metrics : null;
|
||||
|
||||
@@ -92,6 +92,24 @@ describe.runIf(executablePath)("layout audit in Chromium", () => {
|
||||
expect(codes.includes("text_box_overflow")).toBe(error);
|
||||
});
|
||||
it.each([
|
||||
{
|
||||
name: "inherited Greek uppercase with dialytika",
|
||||
parentLang: "el",
|
||||
ownLang: null,
|
||||
transform: "uppercase",
|
||||
text: "ήί",
|
||||
gap: 80,
|
||||
overlap: true,
|
||||
},
|
||||
{
|
||||
name: "inherited Lithuanian lowercase with dot",
|
||||
parentLang: "lt",
|
||||
ownLang: null,
|
||||
transform: "lowercase",
|
||||
text: "Ì",
|
||||
gap: 76,
|
||||
overlap: true,
|
||||
},
|
||||
{
|
||||
name: "inherited Turkish uppercase",
|
||||
parentLang: "tr",
|
||||
|
||||
Reference in New Issue
Block a user