If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Quick Tips for drawing smooth text with Ruby
2 posts
• Page 1 of 1
Quick Tips for drawing smooth text with Ruby
To smooth (aka anti-aliasing) text you use the view class' method ::setTextRenderingHint
But careful, the User Guide is wrong in a specific point. But first things first.
If you don't use the method, all text will be drawn with the systen settings. For example, if ClearType is enabled in the system settings, all text will be drawn with ClearType glyphs.
If you use the method, you seem to have 5 different settings that you call with strings like "off", "antiAlias" and others. But the setting "off" is misleading. It does not turn off textRenderingHints. It is always used. The "off" setting just means, that the system settings are used (just as if you wouldn't use the method at all).
So, to avoid irritations, it might be better to use the enumerations. They are simply indexed, so instead of view.setTextRenderingHint("off"), you can also call view.setTextRenderingHint(0), or view.setTextRenderingHint(4) instead of "antiAliasing", etc.
But if system settings are used, why should I ever use this method? Well, to make sure the user gets what you see. You can enforce a certain anti-aliasing method for every user of your plugin. The best text presentation is done with ClearType, btw.
index 0, “off” = use system settings
index 1, “singleBitPerPixelGridFit” = use glyph bitmaps for each character with hinting
index 2, “singleBitPerPixel” = use glyph bitmaps for each character with no hinting
index 3, “antiAliasGridFit” = use antialiased glyph bitmaps for each character with hinting
index 4, “antiAlias” = use antialiased glyph bitmaps for each character with no hinting
index 5, “clearTypeGridFit” = use ClearType glyph bitmaps for each character with hinting
But careful, the User Guide is wrong in a specific point. But first things first.
If you don't use the method, all text will be drawn with the systen settings. For example, if ClearType is enabled in the system settings, all text will be drawn with ClearType glyphs.
If you use the method, you seem to have 5 different settings that you call with strings like "off", "antiAlias" and others. But the setting "off" is misleading. It does not turn off textRenderingHints. It is always used. The "off" setting just means, that the system settings are used (just as if you wouldn't use the method at all).
So, to avoid irritations, it might be better to use the enumerations. They are simply indexed, so instead of view.setTextRenderingHint("off"), you can also call view.setTextRenderingHint(0), or view.setTextRenderingHint(4) instead of "antiAliasing", etc.
But if system settings are used, why should I ever use this method? Well, to make sure the user gets what you see. You can enforce a certain anti-aliasing method for every user of your plugin. The best text presentation is done with ClearType, btw.
index 0, “off” = use system settings
index 1, “singleBitPerPixelGridFit” = use glyph bitmaps for each character with hinting
index 2, “singleBitPerPixel” = use glyph bitmaps for each character with no hinting
index 3, “antiAliasGridFit” = use antialiased glyph bitmaps for each character with hinting
index 4, “antiAlias” = use antialiased glyph bitmaps for each character with no hinting
index 5, “clearTypeGridFit” = use ClearType glyph bitmaps for each character with hinting
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Quick Tips for drawing smooth text with Ruby
Thanks for the Educational post T.
I can't say that I've used RUBY to do much [if any] TEXT display. I usually resort to the standard FS 'Labels' and such.
Nonetheless ... always welcome learning new techniques and application.
I'd sure like to see some actual Ruby Code to show how the Syntax looks.
Thanks again
I can't say that I've used RUBY to do much [if any] TEXT display. I usually resort to the standard FS 'Labels' and such.
Nonetheless ... always welcome learning new techniques and application.
I'd sure like to see some actual Ruby Code to show how the Syntax looks.
Thanks again
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 64 guests