I’m trying to get the width of a string using Graphics.TextWidth, which works if I specify a font installed on my system, however it’s not seeing fonts imported when the App starts. I’m using some Google fonts and WebListBoxStyleRenderer’s to stylize text on the page, which works great, however when I pass the Google Font name to the g.FontName it doesn’t ‘see’ it. Is there a way to access font information that’s loaded into the WebApp?
Var d As Double
Var p As New Picture(100, 100, 32)
Var g As Graphics = p.Graphics
g.FontName = "Roboto Condensed" // doesn't see this font, but sees system fonts just fine
g.FontSize = 14
d = p.Graphics.TextWidth(s)
// And here’s the header entry. Thanks for your advice!
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<style>.Roboto+Condensed {font-family: 'Roboto Condensed', sans-serif;}</style>
3 posts - 3 participants