Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Precise font metrics

Hi all,

The FontMetrics class only returns rounded int values for ascent, descent and leading values, but I need to know the precise floating point measurements.

I've searched the web for a solution to this problem, but even though I think people would stumble over this issue more frequently, I have found nothing helpful.

Basically, my situation is this. I am working on an SWT/JFace application where the user can edit large rich text documents (WYSIWYG in pages). To support this we developed a new styled text document model with a LineStyleListener based adapter to the SWT StyledText control. The StyledText control itself and the LineStyleListener interface needed heavy modifications for all the features that we needed. In principle we would be willing to donate the related code. At least when I initially researched rich text editing, it appeared many developers were also in need for a powerful framework similar to what is available in Swing. One problem with me donating code could be that I can't promise to maintain anything. But if there were plans already to offer a rich text framework in JFace/SWT that is not focussed on editing code so much as is current JFace/Text, it may be a good starting point.

Anyway, after not paying it enough attention for the longest time, I was looking into more precise text rendering and comparing the amount of glyphs per line and number of lines per page with other text packages and I am realizing that the rounding of the font metrics to integer values could be posing quite a problem for my use case. Neither can I control text rendering beyond anti-alisaing on/off, nor can I position each line based on individual absolute rounding from the page top. So the font metric rounding adds up and I end up fitting much less text on a page compared to other professional text packages.

Can anyone provide some directions which I could investigate to solve this problem? Thank you for any help!

Best regards,
-Stephan



Back to the top