SyntaxEditor Font size specification

SyntaxEditor for WPF Forum

Posted 2 years ago by SPF - Appeon
Version: 22.1.2
Avatar

Both "vs" and "syntaxeditor" set the scale to 100% and the font size to the same size. The font of "vs" is larger than that of "syntaxeditor".

Comments (5)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

The default font for VS 2022 is Cascadia Mono 10pt. The default for SyntaxEditor is Consolas 10pt.  When I changed VS 2022 font to Consolas 10pt and compared screen shots side-by-side, the rendered text of VS and SyntaxEditor had identical character heights and line spacing.

Please double-check that both applications are set to the same font family. If you still believe there is an issue with font sizing, let us know which version of Visual Studio you are using and which font family is being used for the comparison.

[Modified 2 years ago]


Actipro Software Support

Posted 2 years ago by SPF - Appeon
Avatar

Set the fonts on both sides to "Cascadia mono 10pt", and the font size is different.

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

In WPF the default font size is expressed as device independent units that are 1/96 of an inch, but points are measured in 1/72 of an inch. If you configure SyntaxEditor with FontSize="10" that is using WPF units of "10/96 of an inch" which is smaller than "10/72 of an inch" you see in Visual Studio. If you change it to FontSize="10pt" you should see SyntaxEditor render text the same size as what you see in Visual Studio.


Actipro Software Support

Posted 2 years ago by SPF - Appeon
Avatar

We used "highlightingstyle", set "fontsize" to 12, and set the font to the same font. But the display is smaller than vs

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Highlighting style font sizes are double values, and are expressed relative to the target platform.  A HighlightingStyle.FontSize of 12 will therefore be in terms of device independent units (1/96") in WPF whereas the 'points" you want are measured in 1/72".  If you apply a multiplication factor of 96/72 to your current HighlightingStyle.FontSize value, then it should be your target "point" font size.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.