-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More information about Privacy Considerations.
- Loading branch information
Showing
5 changed files
with
151 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<style> | ||
@font-face { | ||
font-family: MyWebFontWithVeryWideGlyphs; | ||
src: url("/fonts/my-web-fonts-with-very-wide-glyphs.woff"); | ||
} | ||
#container { | ||
font-family: AWellKnownSystemFont, MyWebFontWithVeryWideGlyphs; | ||
} | ||
</style> | ||
<div id="container">SOMETEXT</div> | ||
<div id="reference">SOMETEXT</div> | ||
<script> | ||
document.fonts.ready.then(() => { | ||
let containerWidth = | ||
document.getElementById("container").getBoundingClientRect().width; | ||
let referenceWidth = | ||
document.getElementById("reference").getBoundingClientRect().width; | ||
let isWellKnownSystemFontAvailable = | ||
Math.abs(containerWidth - referenceWidth) < 1; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<style> | ||
@font-face { | ||
font-family: MyWebFontWithVeryWideAsianGlyphs; | ||
src: url("/fonts/my-web-fonts-with-very-wide-asian-glyphs.woff"); | ||
} | ||
#container { | ||
font-family: ui-serif, MyWebFontWithVeryWideAsianGlyphs | ||
} | ||
#reference { | ||
font-family: MyWebFontWithVeryWideAsianGlyphs; | ||
} | ||
</style> | ||
<div id="container">王</div> | ||
<div id="reference">王</div> | ||
<script> | ||
document.fonts.ready.then(() => { | ||
let containerWidth = | ||
document.getElementById("container").getBoundingClientRect().width; | ||
let referenceWidth = | ||
document.getElementById("reference").getBoundingClientRect().width; | ||
let uiSerifFontDoesNotContainAsianGlyph = | ||
Math.abs(containerWidth - referenceWidth) < 1; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<style> | ||
#test { | ||
font-size: 100px; | ||
} | ||
#container { | ||
text-decoration-line: underline; | ||
text-decoration-thickness: from-font; | ||
} | ||
#reference { | ||
text-decoration-line: underline; | ||
text-decoration-thickness: 1em; | ||
} | ||
</style> | ||
<div id="test"> | ||
<div id="container">SOMETEXT</div> | ||
<div id="reference">SOMETEXT</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
let svg = ` | ||
<svg xmlns="http://www.w3.org/2000/svg" width="100px" height="100px"> | ||
<foreignObject width="100" height="100" | ||
requiredExtensions="http://www.w3.org/1998/Math/MathML"> | ||
<math xmlns="http://www.w3.org/1998/Math/MathML"> | ||
<msqrt style="font-size: 25px"> | ||
<mtext>■</mtext> | ||
<mtext><a href="https://example.org/">■</a></mtext> | ||
</msqrt> | ||
</math> | ||
</foreignObject> | ||
</svg>`; | ||
let image = new Image(); | ||
image.width = 100; | ||
image.height = 100; | ||
image.onload = () => { | ||
let canvas = document.createElement('canvas'); | ||
canvas.width = 100; | ||
canvas.height = 100; | ||
canvas.style = "border: 1px solid black"; | ||
document.body.appendChild(canvas); | ||
let context = canvas.getContext("2d"); | ||
context.drawImage(image, 0, 0); | ||
}; | ||
image.src = `data:image/svg+xml;base64,${window.btoa(svg)}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters