Kerning and other glyph placement issues |
JetForMe
|
I'm using SDL_ttf, but having some rather poor results:
http://cl.ly/image/3X350h1p3I2x/Screen%20Shot%202014-07-01%20at%202.23.30%20.png Each of those fields is rendered as one surface, with this code: SDL_Surface* sdlS = ::TTF_RenderUTF8_Blended(mFont, mText.c_str(), mTextColor); int result = ::SDL_BlitSurface(sdlS, NULL, mDisplay, &destRect); Notice how the bases of each glyph jitter, as well as the size of glyphs relative to adjacent characters (e.g. "Sun")? Notice how the 6 and 9 have fattened vertical sections? I'm using a Helvetica Neue I found online, but it renders perfectly in OS X's quicklook: http://cl.ly/image/3Z0j2T3z0u36/Screen%20Shot%202014-07-01%20at%202.28.13%20.png Any suggestions? Thanks! -- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|
Kerning and other glyph placement issues |
slvn
|
Hi,
Strange, could this be : - your "destRect" which is small and induces (bad) rescaling - your freetype lib (old?) - a bug in sdl_ttf, try the latest version of trunk. - give a try with different fonts. Provide me the ttf font file, so I can have a look. Cheers, Sylvain On Tue, Jul 1, 2014 at 11:28 AM, Rick Mann wrote:
-- Sylvain Becker _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
On Jul 2, 2014, at 11:23 , Sylvain Becker wrote:
I understood that it ignores the width and height, and only uses the origin. From the docs here: https://wiki.libsdl.org/SDL_BlitSurface?highlight=%28%5CbCategoryAPI%5Cb%29%7C%28SDLFunctionTemplate%29 "Only the position is used in the dstrect (the width and height are ignored)."
Possibly. I just found it online somewhere. Here it is: http://cl.ly/1A3B2f2W2W3H/HelveticaNeue-Regular.ttf
I'm using the following OS X frameworks: #define SDL_TTF_MAJOR_VERSION 2 #define SDL_TTF_MINOR_VERSION 0 #define SDL_TTF_PATCHLEVEL 11 #define SDL_MAJOR_VERSION 1 #define SDL_MINOR_VERSION 2 #define SDL_PATCHLEVEL 15 Unfortunately, I have to use SDL 1.2 because the target hardware, a BeagleBone Black, isn't supported by SDL 2.0.
I'll try to find another.
http://cl.ly/1A3B2f2W2W3H/HelveticaNeue-Regular.ttf Thanks! -- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
On Jul 2, 2014, at 11:23 , Sylvain Becker wrote:
I tried it with an OTF version of the font, and while the glyph positioning is different, it's still all over the map. -- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Kerning and other glyph placement issues |
slvn
|
I mixed SDL_BlitSurface and SDL_RenderCopy, the DstRect is indeed used
for positionning only. Your font, with SDL2, looks correct to me ... Also, you can try with TTF_RenderUTF8_Shaded, instead of TTF_RenderUTF8_Blender I am almost sure that you can use the SDL2_ttf2 with SDL-1.2 Give a try only replacing SDL_ttf.c On Wed, Jul 2, 2014 at 10:54 PM, Rick Mann wrote:
-- Sylvain Becker _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
On Jul 2, 2014, at 14:09 , Sylvain Becker wrote:
I did try those before. It had the same effect (except that it fills the background as well).
Yes, I've been using it without problems this whole time. I didn't replace any files, though, it just seemed to work (except for this glyph issue). I'm happy to give you the whole source to try. It runs on OS X (it's an Xcode project), but the Makefile builds for Debian on BeagleBone Black, shouldn't be too hard to get it to build for whatever Linux you want, assuming SDL 1.2. I haven't built for Debian in a while, though. I'll have to try that tonight at home. I also want to try that to see if it has the same results. Is there a way to generate PNG files from my display surface (for screenshots)?
-- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
I tried it on the BeagleBone Black/Debian, I get the exact same results. I'm not very well versed with git, but I've put my code up there:
https://github.com/JetForMe/SPSDisplay On Jul 2, 2014, at 14:09 , Sylvain Becker wrote:
-- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||
|
Kerning and other glyph placement issues |
slvn
|
Make sure you are using the latest version of the file "SDL_ttf.c" for
the SDL_ttf mercurial trunk ! (I mean not only the SDL2 version) Which size are you using for the font ? I won't be able to run your code as I dont use sdl-1.2 anymore, and dont want to port the whole app. Please, write a minimal test case if you want me to run it ! Then, I will try it tomorrow. To answer your question : if I remember correctly, you can save surface to image with SDL_SaveBmp Cheers, Sylvain On Thu, Jul 3, 2014 at 9:09 AM, Rick Mann wrote:
-- Sylvain Becker _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
Hmm. I'm using the Framework. I'd have to get the whole thing and build it.
On Jul 3, 2014, at 00:39 , Sylvain Becker wrote:
-- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
Yeah, I can't figure out how to build the frameworks. They don't just build out of the box.
On Jul 3, 2014, at 00:39 , Sylvain Becker wrote:
-- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||||||
|
Kerning and other glyph placement issues |
Jonathan Greig
Guest
|
SDL and SDL2 doesn't really take very long to build.
I got it to build and run on Kubuntu 14.04 but all I got was a black screen and it jacked my resolution to 640x480. I'm not very fluent with OSX as I am Linux. On Thu, Jul 3, 2014 at 3:45 AM, Rick Mann wrote:
|
|||||||||||||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
Maybe not, unless they don't build cleanly. Also, I'm trying to build the Xcode Framework, not the regular lib.
Sylvain, here's a small sample: https://pastee.org/wda6 It produces this: http://cl.ly/image/1N1h232k0B1g/Screen%20Shot%202014-07-03%20at%202.56.49%20.png This is with the 2.0.11 SDL 1.2 Framework. On Jul 3, 2014, at 02:03 , Jonathan Greig wrote:
-- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||||||||
|
Kerning and other glyph placement issues |
Jonathan Greig
Guest
|
No it wasn't cleanly, but here is the compile log. Not many issues, but a few:
``` jpg@trusty-laptop:~/Desktop/sdlq/SPSDisplay/SPSDisplay/trunk$ make gcc -c -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT spa.c -o spa.o gcc -MM -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT spa.c > spa.d g++ -c -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SDL/SDLDisplay.cpp -o SDL/SDLDisplay.o g++ -MM -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SDL/SDLDisplay.cpp > SDL/SDLDisplay.d g++ -c -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SDL/SDLFont.cpp -o SDL/SDLFont.o g++ -MM -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SDL/SDLFont.cpp > SDL/SDLFont.d g++ -c -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SDL/SDLLabel.cpp -o SDL/SDLLabel.o g++ -MM -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SDL/SDLLabel.cpp > SDL/SDLLabel.d g++ -c -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SDL/SDLSurface.cpp -o SDL/SDLSurface.o g++ -MM -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SDL/SDLSurface.cpp > SDL/SDLSurface.d g++ -c -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SDL/SDLView.cpp -o SDL/SDLView.o In file included from SDL/SDLView.cpp:9:0: SDL/SDLView.h: In constructor ‘SDLView::SDLView(const SDL_Rect&)’: SDL/SDLView.h:57:15: warning: ‘SDLView::mBackgroundColor’ will be initialized after [-Wreorder]  SDL_Color   mBackgroundColor;         ^ SDL/SDLView.h:55:11: warning:  ‘bool SDLView::mNeedsDisplay’ [-Wreorder]  bool   mNeedsDisplay;       ^ SDL/SDLView.cpp:24:1: warning:  when initialized here [-Wreorder]  SDLView::SDLView(const SDL_Rect& inFrame)  ^ In file included from SDL/SDLView.cpp:9:0: SDL/SDLView.h: In constructor ‘SDLView::SDLView(int16_t, int16_t, uint16_t, uint16_t)’: SDL/SDLView.h:57:15: warning: ‘SDLView::mBackgroundColor’ will be initialized after [-Wreorder]  SDL_Color   mBackgroundColor;         ^ SDL/SDLView.h:55:11: warning:  ‘bool SDLView::mNeedsDisplay’ [-Wreorder]  bool   mNeedsDisplay;       ^ SDL/SDLView.cpp:32:1: warning:  when initialized here [-Wreorder]  SDLView::SDLView(int16_t inX, int16_t inY, uint16_t inWidth, uint16_t inHeight)  ^ g++ -MM -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SDL/SDLView.cpp > SDL/SDLView.d g++ -c -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x BBBDisplayApp.cpp -o BBBDisplayApp.o g++ -MM -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x BBBDisplayApp.cpp > BBBDisplayApp.d g++ -c -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x ChargeController.cpp -o ChargeController.o g++ -MM -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x ChargeController.cpp > ChargeController.d g++ -c -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SPSDisplayApp.cpp -o SPSDisplayApp.o SPSDisplayApp.cpp: In member function ‘virtual bool SPSDisplayApp::init()’:                              SPSDisplayApp.cpp:85:11: warning: unused variable ‘labelFontBold’ [-Wunused-variable]                          SDLFont* labelFontBold = SDLFont::fontForName("HelveticaNeue-Bold.ttf", 12);                                  ^                                                             g++ -MM -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x SPSDisplayApp.cpp > SPSDisplayApp.d             g++ -c -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x TristarMPPT.cpp -o TristarMPPT.o               g++ -MM -g -Wall -I. -ISDL -Wno-unknown-pragmas -D_REENTRANT -std=gnu++0x TristarMPPT.cpp > TristarMPPT.d               g++ spa.o SDL/SDLDisplay.o SDL/SDLFont.o SDL/SDLLabel.o SDL/SDLSurface.o SDL/SDLView.o BBBDisplayApp.o ChargeController.o SPSDisplayApp.o TristarMPPT.o -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL -lSDL_ttf -lmodbus -lpthread -o app               jpg@trusty-laptop:~/Desktop/sdlq/SPSDisplay/SPSDisplay/trunk$ ``` On Thu, Jul 3, 2014 at 4:59 AM, Rick Mann wrote:
|
|||||||||||||||||||||||||
|
Kerning and other glyph placement issues |
slvn
|
Rick,
I tried with the latest version and I have the same rendering issue ! I opened a bug for that : https://bugzilla.libsdl.org/show_bug.cgi?id=2622 Maybe add yourself to the CC list to know about it ... In the mean time use another font or try fixing is with SDL2 environment . Cheers, Sylvain On Thu, Jul 3, 2014 at 12:09 PM, Jonathan Greig wrote:
-- Sylvain Becker _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
On Jul 3, 2014, at 12:07 , Sylvain Becker wrote:
If I knew how to get fbdev support working in SDL2, I would! That's the only reason I can't. OpenGL isn't working on the BeagleBone Black. -- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
On Jul 3, 2014, at 12:07 , Sylvain Becker wrote:
Thanks! So, you think a different font works? I'll take any modern-looking font that has the numbers, decimal, and colon all monospaced. -- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Kerning and other glyph placement issues |
slvn
|
I mean the problem is there also in SDL2 with this font and latest SDL_ttf.
If you get it solve for SDL2, very likely, it will be solved for SDL1.2 as well. I am not sure about *monospaced* font. it worth a try... On Thu, Jul 3, 2014 at 9:28 PM, Rick Mann wrote:
-- Sylvain Becker _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
mr_tawan
|
|
|||||||||||
|
mr_tawan
|
Indeed it looks pretty bad on the small text.
Here I use HelveticaNeue-Regular you posted on the top, SourceSansPro-Regular.ttf, and then SourceSansPro-Regular.otf on the bottom. All of them are 16 point height. The otf varient is drawn slightly different due to the FreeType2 2.5 which includes Adobe's rasterizer, the ttf verrsion uses old rasterizer. I think if you're using FreeType 2 below version 2.4.12, the output would be on par or even worse than ttf version though. You can get source sans pro from http://sourceforge.net/projects/sourcesans.adobe/ |
|||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
Thanks. How do I use SourceSans? I don't see a plain .otf version in there.
I have FreeType 2.5.3 installed on this machine, although I'm not sure SDL 1.2 Framework is using it (I think it embeds its own FreeType). On Jul 3, 2014, at 14:47 , mr_tawan wrote:
-- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
Oh, nevermind, I found the font files.
On Jul 3, 2014, at 15:01 , Rick Mann wrote:
-- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
Hmm. I tried SourceSansPro Regular and Bold. Unfortunately, the inter-numeral kerning is still imperfect (5 abuts the previous glyph too closely), and the numerals aren't constant width. The "4" is wider than the rest, causing strings of numbers to shift as they change.
http://cl.ly/image/1S0q3B2g0u0y/SourceSansPro.png On Jul 3, 2014, at 14:47 , mr_tawan wrote:
-- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
On Jul 3, 2014, at 12:41 , Sylvain Becker wrote:
Well, I tried it with Verdana. Seems to work well. I also tried SourceSansPro, but it had similar (although less severe problems). I may just stick with Verdana from now on out. -- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Kerning and other glyph placement issues |
slvn
|
Rick, I am not an expert of FT, but here's what I found.
When using size 12, the 'n' gets a bad "horiBearingY" value from freetype (at least compared to the 'u'). This is the Y offset, when writing in horizontal layout. See: http://www.freetype.org/freetype2/docs/glyphs/ http://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html If you use a different size (11 or 13), you get better result because the "horiBearingY" of 'u' and 'n' are equals But it seems that if the font get loaded with different hint flags, you have also better result. So after loading the font, you can use: TTF_SetFontHinting(font, TTF_HINTING_LIGHT); Cheers, Sylvain On Fri, Jul 4, 2014 at 9:45 AM, mr_tawan wrote:
-- Sylvain Becker _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
I didn't want a fully monospaced font, just one where the numerals and decimal point are all the same width. Source doesn't seem to meet this criteria. Helvetica also doesn't, but Helvetica Neue does (but has other problems).
Verdana is going to work for me, though, and doesn't exhibit those problems. On Jul 4, 2014, at 00:45 , mr_tawan wrote:
-- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Kerning and other glyph placement issues |
JetForMe
|
Thanks, Sylvain, I'll keep that in mind.
On Jul 4, 2014, at 02:47 , Sylvain Becker wrote:
-- Rick _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|