<html><head>

<style type="text/css"><!--#xcf619022220d460 blockquote.cite2
{margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right: 0px; border-left: 1px solid rgb(204, 204, 204); margin-top: 3px; padding-top: 0px;}
#xcf619022220d460
{font-family: "Segoe UI"; font-size: 12pt;}
--></style><style id="css_styles" type="text/css"><!--blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
a img { border: 0px; }
li[style='text-align: center;'], li[style='text-align: center; '], li[style='text-align: right;'], li[style='text-align: right; '] {  list-style-position: inside;}
body { font-family: 'Segoe UI'; font-size: 12pt; }
.quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb solid; padding-left: 0.3em; }
a.em-mention[href] { text-decoration: none; color: inherit; border-radius: 3px; padding-left: 2px; padding-right: 2px; background-color: #e2e2e2; }
._em_placeholder {color: gray; border-bottom: 1px dotted lightblue;} ._em_placeholder:before{color:gray; content: '{{ ';} ._em_placeholder:after{color:gray; content: ' }}';}
--></style>
</head>
<body><div>I'm not sure whether this message originally got through.  I got a response indicating it was being held until moderator review because it was too large (because I had attached the .ttf file I was working with, and that was > 512 Kb).  The message suggested that if I didn't receive notification of the moderator's decision, that it would get posted.  And I didn't.  At least not so far.</div><div><br /></div><div>Anyway, I found a solution/work-around for the problem.</div><div><br /></div><div>In the <font face="Consolas" size="3" style="font-size: 16px;">Highlighter</font> class (that's derived from <font face="Consolas">QSyntaxHighlighter</font>), I create a <font face="Consolas" size="3" style="font-size: 16px;">QTextCharFormat</font> object.  If I call <font face="Consolas" size="3" style="font-size: 16px;">.setFontHintingPreference(PreferNoHinting)</font> again on that object, then the text displayed by the syntax highlighter looks better -- like the other text.  (Line #152 in the attached file)</div><div><br /></div><div>/John</div>
<div><br /></div>
<div x-em-replyforwardheader=""><br /></div>
<div>
<div>------ Original Message ------</div>
<div>From "John Sturtz" <<a href="mailto:john@sturtz.org">john@sturtz.org</a>></div>
<div>To <a href="mailto:pyqt@riverbankcomputing.com">pyqt@riverbankcomputing.com</a></div>
<div>Date 11/2/2025 9:21:50 PM</div>
<div>Subject QSyntaxHighlighter text quality</div></div><div x-em-quote=""><br /></div>
<div id="xcf619022220d460"><blockquote cite="em7a866cd7-6997-43da-b3c1-bcceefc7fbd1@29d393a1.com" type="cite" class="cite2">
Hi again.<div><br /></div><div>With some trepidation, I have a question about fonts again.  Not so much about fonts in general, but about display quality of the font I am using.</div><div><br /></div><div>I have a <font face="Consolas">QTableView</font> with a custom delegate.  The delegate editor is implemented as a <font face="Consolas" size="3" style="font-size: 16px;">QPlainTextEdit</font> widget which has a <font face="Consolas" size="3" style="font-size: 16px;">QSyntaxHighlighter</font> associated with it.</div><div><br /></div><div>I am loading a .ttf file at runtime and using it as the display font.  Initially the quality is pretty poor everywhere [attached screenshot <b>initial.png</b>].</div><div><br /></div><div>I found online the suggestion to create a font object, call <font face="Consolas" size="3" style="font-size: 16px;">.setHintingPreference(PreferNoHinting)</font> on it, then apply that to the <font face="Consolas" size="3" style="font-size: 16px;">QApplication</font> object [lines #175-177].  That seems to improve the display significantly.</div><div><br /></div><div>Except for the text displayed by the syntax highlighter.  That text is still pixelated [attached screenshot <b>highlighter.png</b>].  It's as though the <font face="Consolas" size="3" style="font-size: 16px;">.setHintingPreference()</font> call doesn't affect the syntax highlighter.</div><div><br /></div><div>Wondering if there's any way around this?</div><div><br /></div><div>Thanks again!</div><div><br /></div><div>/John</div><div><br /></div><div><i>[Sample code, screenshots and font file are attached]</i></div></blockquote></div>
</body></html>