Edwin Yip 154 Posted October 17, 2022 Hi, I wonder if anyone, especially @Alexander Sviridenkov can give me any advise as to solving the following ThtPanel (a control from delphihtmlcomponents.com) rendering issue (text overlapped) under win 10/11 (ok under win 7). - The screenshot of the issue is attached. - I'm using HCL 3.7 (not the latest, I know, but I'm afraid I need to solve this issue with this version at the moment). - The html code used: Trial Period's Expiring in 21 Day(s)<br />When in trial mode only <strong>20</strong> blabla.<br /><br /><a href="#buy">Buy MyProduct here</a><br /><br /><a href="#activate">Activate MyProduct</a> if you already have a license key - The `ThtPanel` object: var pnlMsg := THtPanel.Create(Self); pnlMsg.Parent := Self; pnlMsg.AlignWithMargins := True; pnlMsg.Hint := '[Ctrl + C] to copy the message to clipboard'; pnlMsg.Align := alClient; pnlMsg.Caption := 'pnlMsg'; pnlMsg.ParentBackground := False; pnlMsg.ParentColor := True; pnlMsg.ParentFont := False; pnlMsg.ParentShowHint := False; pnlMsg.PopupMenu := pmMsg; pnlMsg.ShowHint := True; pnlMsg.TabOrder := 1; pnlMsg.Styles.Clear; pnlMsg.Styles.Add('a {'); pnlMsg.Styles.Add(' color: #0088cc;'); pnlMsg.Styles.Add('}'); pnlMsg.TouchScroll := False; pnlMsg.VerticalScrollBar := hsbAuto; pnlMsg.HighlightTextColor := 0; pnlMsg.EnableSelection := True; Share this post Link to post
Edwin Yip 154 Posted October 17, 2022 Typo: In the attached screenshot, "I masked on this area..." should be "I masked only this area..." Share this post Link to post
Alexander Sviridenkov 357 Posted October 17, 2022 Is it present when using all canvas classes (THtCanvasGDI, THtCanvasDX, THtCanvasGP)? Also does simple test project (form and HtPanel created at design time) has the same issue? Share this post Link to post
Edwin Yip 154 Posted October 17, 2022 Thanks for the help Alexander. So I've just tried: - THtCanvasGDI: I assume this the default so it has the issue. - THtCanvasGP: Tried `HtDefaultCanvasClass := THtCanvasGP`, and it's the same issue. - THtCanvasDX: `HtDefaultCanvasClass := THtCanvasDX` solves the issue! And the html code is updated at runtime like this: `pnlMsg.HTML.Text := aHtmlCode` PS, I prefer `THtCanvasGDI` because the text rendering is the same as the system. Share this post Link to post
Alexander Sviridenkov 357 Posted October 17, 2022 Default is THtCanvasGP (GDI+). Current version works fine on Windows10/11, so I don't know what may cause this issue in 3.7. Have you tried different fonts (Arial, Tahoma, etc)? Share this post Link to post
Edwin Yip 154 Posted October 17, 2022 Oh I thought THtCanvasGDI is the default one...So I tried THtCanvasGDI has no issue. Question now: I assume changing `HtDefaultCanvasClass` only affects text rendering, but not other parts such as imaging rendering, is that correct? If so, I can use THtCanvasGDI to workaround the issue... Conclusion: With HCL 3.7 (not sure about the other versions), THtCanvasGP has text overlapping rendering issue, but both THtCanvasGDI and THtCanvasDX are OK. Share this post Link to post
Alexander Sviridenkov 357 Posted October 17, 2022 This may be related to incorrect font information returned by WinAPI for new fonts in W10/11. AFIR latest HCL versions contains workaround for this. Whole rendering in one control is performed using single canvas class. You can set canvas class separately for each control but they cannot be mixed. Share this post Link to post