fontsize et fontface are not displayed coorectly

22 views
Skip to first unread message

Abdelkader Belahcene

unread,
Jan 5, 2016, 5:09:38 PM1/5/16
to fltk.general
Hi,
I wrote the same Hello.cxx programme as in doc, The word   Hello World is dispIayed in the standard size , and not in the size I used (36), same problem with the face,.

I mean the commands :
   box->labelsize(36);
   box->labelfont(FL_BOLD+FL_ITALIC);
don't changing anything  for the text

This program worked corretly in previous version of flrk.  I am using the last version 1.3.3.

Here is the the graph displayed by the hello in the official  test directory


but the fonts  program from test directory works correctly  (  this one use the draw fonction !!)
thanks for help.

 regards
hello.png

Greg Ercolano

unread,
Jan 5, 2016, 5:27:49 PM1/5/16
to fltkg...@googlegroups.com
On 01/05/16 13:40, Abdelkader Belahcene wrote:
> I wrote the same Hello.cxx programme as in doc, The word Hello World is
> dispIayed in the standard size , and not in the size I used (36), same problem with the face,.
>
> I mean the commands :
>
> box->labelsize(36);
> box->labelfont(FL_BOLD+FL_ITALIC);

BTW, normally one would include a font name in there, e.g.

box->labelfont(FL_HELVETICA+FL_BOLD+FL_ITALIC); // helvetica bold italic

..or:

box->labelfont(FL_COURIER+FL_BOLD+FL_ITALIC); // courier bold italic

I believe if the font is unspecified, it uses FL_HELVETICA
(which ends up being 0), so what you have should be OK.

But for testing purposes, see if making it FL_COURIER
lets the size change, which might indicate the font FLTK is
using for FL_HELVETICA is for some reason unavailable, or
is available, but not in multiple sizes.

> don't changing anything for the text
> ..
> Here is the [screenshot] displayed by the hello in the official test directory

I'm guessing from the title bar of your screenshot
that the operating system is linux, and therefore X11.

The text in the screenshot you included looks suspiciously
like an *un*-antialised font, is this intentional?

Normally under linux, FLTK wants to use XFT, which gives better results
for font rendering and more flexibility with font size changes.

First, if you're building FLTK 1.3.3 from scratch (downloaded as a
source tarball), be sure when you run './configure' that it is detecting
XFT.

Also, make sure you're not getting interference from a previously installed
version of FLTK: check to see if /usr/include/FL exists, and if it does,
rename it away so that your new 1.3.3 doesn't accidentally use that previous
install's #include files when building the lib or the apps.

Then rebuild FLTK 1.3.3 (make clean; make) and rebuild your app.

If you're purposefully not using XFT, then make sure the base fonts
FLTK needs are there. If they're not available, FLTK is probably falling
back to some generic font whose size is fixed.

Some other folks here might have other ideas too..

Ian MacArthur

unread,
Jan 5, 2016, 5:32:43 PM1/5/16
to fltkg...@googlegroups.com
On Tue Jan 05 2016 21:40:01, Abdelkader Belahcene wrote:
> Hi,
> I wrote the same Hello.cxx programme as in doc, The word Hello World is dispIayed in the standard size , and not in the size I used (36), same problem with the face,.
>
> I mean the commands :
> box->labelsize(36);
> box->labelfont(FL_BOLD+FL_ITALIC);
>

I’d suggest that, strictly speaking, this ought to be something more like...

box->labelfont(FL_HELVETICA | FL_BOLD | FL_ITALIC);

But I don’t think that’s what’s causing the issue here...



> don't changing anything for the text
>
> This program worked corretly in previous version of flrk. I am using the last version 1.3.3.


It’s a bit hard to tell from the image you posted, but zooming in on the text it looks like the font that is being used is a bitmapped font face, not a scalable font.

What platform are you on? If it is *nix/X11 based, are you using Xlib fonts or the XFT font system? And do you have scalable fonts installed, if you are using XFT?

From the image you posted, it looks very much as if your application code is not finding the font face it wants and is therefore falling back to a safe default...



Abdelkader Belahcene

unread,
Jan 6, 2016, 12:59:51 PM1/6/16
to fltk.general






Thanks a lot
Following the recommandations I solved the  problem 
thanks again





 
Reply all
Reply to author
Forward
0 new messages