-
Notifications
You must be signed in to change notification settings - Fork 139
When converting to WPF, some system fonts (such as Arial Narrow) are not rendered: they are substituted by the default font. #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What is the result you are getting? Display the XAML. |
Hello,
I will add a screenshot of the result on my machine, as a response of the issue.
To see this "Arial Narrow" in the interface:
If I go to "C:\Windows\Fonts", and then I double-click "Arial", I see that "Arial Narrow" in the "Font Family Details".
KR
…________________________________
From: Paul Selormey ***@***.***>
Sent: Tuesday, February 11, 2025 3:12 PM
To: ElinamLLC/SharpVectors ***@***.***>
Cc: Quantick ***@***.***>; Author ***@***.***>
Subject: Re: [ElinamLLC/SharpVectors] When converting to WPF, some system fonts (such as Arial Narrow) are not rendered: they are substituted by the default font. (Issue #301)
What is the result you are getting? Display the XAML.
I run it on the machine that I used for SharpVectors development (Windows 10) and it
has not Arial Narrow so Arial/Arial Bold are used.
—
Reply to this email directly, view it on GitHub<#301 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AH6X7BACPAUPPOPTFLBYPAT2PIAOBAVCNFSM6AAAAABW2TPKI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNJQHE2DGOJZGQ>.
You are receiving this because you authored the thread.
|
And the xaml output is:
|
I am now back home and I have more information - as my main machine here is still Win10. Situation: On Win10, in Edge, the SVG appears with labels overlapping with the rectangles (see scfreenshot below) - and inside C:\Windows\Fonts\Arial, I don't have any "Arial Narrow" entry. On every Win11 I have access to, in Edge, the SVG appears as I expect - that is without overlapping - and inside C:\Windows\Fonts\Arial, I see that "Arial Narrow" entry. Win11 rendering of the SVG in Edge: |
Even on system where Thanks for the additional information. I will investigate the best way to resolve this issue. |
Indeed, On the other side, my own little investigations show |
Hi Paulushub, Any news on this? |
Sorry for the delay, my old developer environment is down. It is a Windows 10, that will not be upgraded but |
The context is:
<text font-family="'Arial Narrow'" ...>Some text intended to use the Arial Narrow Font</text>
The result is unexpected.
Namely: that text is rendered using the default font, Arial.
The following SVG can be saved and used inside the
WpfSvgTestBox
sample application.The browser renders everything as expected. But in the sample application, the labels overlap with the rectangles because they render using the Arial font instead.
I tested several things around the usage of
WpfDrawingSettings
:FontFamillyVisitor
property does not help: the custom visitor is not even called (an issue by itself).AddFontFamillyName("Arial Narrow", "Arial Narrow")
does not help.DefaultFontName = "Arial Narrow"
is for sure not a solution, but it demonstrates the library can give access to this font, as it renders this very SVG correctly.Only a code change in the
SharpVectors.Rendering.Wpf
project allowed me to have something more satisfying.In the
SharpVectors.Renderers.Texts.WpfTextRenderer
class, theBuildSystemFonts
method should read:This requires the
System.Drawing.Common
Nuget package to be added to theSharpVectors.Rendering.Wpf
project.Remark: this is the change that brings the 'Arial Narrow' font into the list of considered system fonts.
Fonts.SystemFontFamilies
does not return it.Then in the
SharpVectors.Converters.FontFamilyVisitor
class, theVisit
method should begin with:This is just a proposal of course, I have no idea if that could cause any regression.
The text was updated successfully, but these errors were encountered: