Minimum underline thickness?

  • When I use a font of 8pt, sometimes you can see the underline and sometimes you can't unless you zoom to something other than 100%. Like at 90%, and 120% you seem to be able to see all the underlines, but not at 100%. If I use the wpdrawfineunderlines option, it seems to work just fine at any zoom level or font size (editor or print preview). However, the line thickness in this case does not change at different zoom levels or font sizes... it is always thin.

    Am I missing an option for drawing the underline at a *minimum* thickness so that it will draw the lines *at least* a certain thickness and still allow thicker underlines?

  • Windows always pains at least a hair line, even when the Pen.Width = 0, so this is not the problem.

    But when the lines become very small it is possible that the following line paints over the previous after the scaling has taken place.

    Scaling is internally done because WPTools is resolution independent. It always calculates a defined dpi setting.

    Please see chapter "Programming/Introduction/WYSIWYG" in the manual for more information.

    You can set the flag wpfAlwaysFormatWithScreenRes in the property FormatOptions of the TWPRichText if you do not need WYSIWYG.

  • We need WYSIWYG, so what I was trying to ask is why enabling wpdrawfineunderlines seems to work but with the downside being that they are always thin? I have not looked into your code to see what happens when that is enabled. Is it that the Pen.Width is always set to 1? If Windows is drawing a hairline when the Pen.Width is 0, then I would think that is truly the problem. A hairline drawn between screen pixels will not show up.

  • For grins I tried the wpfAlwaysFormatWithScreenRes option and still had the issue at various zoom levels not seeing the underline. Again, wpdrawfineunderlines has no problems other than always being thin, which, if I think about it, might be OK when editing and for print preview, but then disable it when ready to print or output to PDF.should that be a concern there.

  • After playing with it for a while, everyone I've shown it to all agree that a consistent underline thickness for all font sizes and outputs, etc is best, so we'll just keep wpdrawfineunderlines enabled in all cases, i.e. the editor, previewing, printing and exporting to PDF.

  • Thanks for finding wpdrawfineunderlines, it was specially implemented for that reason. It is a matter of taste if you want to adapt the line thickness to the font height. WPTools is not using the fsUnderline style for text output internally, since that will not draw continues lines with text of different sizes.