11-22-2012 03:19 PM
Since the simulator returns 0 if you ask for the screen dpi using :
dpi = bbutil_calculate_dpi(screen_cxt);
what dpi should be specified for testing?
I have tried setting it to 170, but my text seems very small when I compare to the same code running on the PB OS 2.1
Solved! Go to Solution.
11-22-2012 03:44 PM
11-22-2012 03:48 PM
this function returns 358 on my Alpha device -)
11-22-2012 05:16 PM
Thanks. That is what I'm after.
However, I found a problem with the dpi value in my code and fixed it.
If I use dpi=170 with the simulator, the text looks reasonable.
If I use dpi=356, the text appears too small.
Not having a device in hand, I can't check it.
Would it be safe to assume that the simulator is based on 170dpi, while the device will actually be 356 (or 358 as posted by another developer), and that if I just used the value returned by bbutil_calculate_dpi(screen_cxt); , the text will appear OK on the device?
Thanks
11-22-2012 05:18 PM
11-22-2012 05:20 PM
Using opengl ES 1.1, so I use bbutil_render_text
11-22-2012 05:25 PM
11-22-2012 05:36 PM
Loading the font with
bbutil_load_font( "/usr/fonts/font_repository/monotype/arialbd.ttf", 48, dpi);
is dependent on the dpi.
I.e. I believe that bbutil_load_font is scaling the requested size (48 here) based on the dpi of the screen so that, for example, if a font size was used that was 1/2 the screen height, it would always appear 1/2 screen height on a 170dpi screen or a 356dpi screen.
bbutil_render_text does not include a font size parameter, since this is determined by bbutil_load_font
11-22-2012 05:50 PM
This is what I mean:
int point_size10 = (int)(10.0f / ((float)dpi / 170.0f ));
fontMono10 = bbutil_load_font("/usr/fonts/font_repository/monot