STR #1977

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File ]

STR #1977

Application:FLTK Library
Status:5 - New
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:2 - Specific to an operating system
Summary:fltk::setfont() documentation error on linux/x11/xft
Created By:ddurham
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]

No files

Trouble Report Comments:

Post Text ]
Name/Time/Date Text top right image
#1 ddurham
14:07 Jun 04, 2008
I've been having some inconsistant font sizing in my linux/x11 application written in fltk2 when it runs on various disroes.  I finally found time to try and diagnose the problem and discovered a possible error in the documentation.

I my app, I'm using drawtext() to custom draw some text on the window but the font sizing has been big on some machines and small on others (linux only here)

It states that you should pass pixel size to fltk::setfont() and gives you a formula for converting your desired point size into a pixel size acceptable to fltk::setfont().

So I started a debugger to see what fltk itself passes to setfont() when it, for example, draws a widget's label. (src/Widget_draw.cxx -> draw_label())

I see it passing "12" to fltk::setfont() which seems like a reasonable point size.

But moreover, then I traced into (all in src/x11/Font_xft.cxx) fltk::setfont() which calls fontopen() which calls XftFontOpen and passes it the size given to fltk::setFont() unmodified.   And, the reference for XftOpenFont() indicates that it should be passed point size.

I don't know if this is an inconsitancy between, say, win32 and x11, or just an error in the docs for both platforms.

Also, x11 has another font implementation in Font_xlfd.cxx (which I believe is much more rarely used), but I have not checked if xlfd's font opening/listing function deals natively with point or pixel sizes.
bottom left image   bottom right image

Return to Bugs & Features | Post Text | Post File ]


Comments are owned by the poster. All other content is copyright 1998-2023 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.