FLTK logo

STR #2215

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 1.3 | SVN ⇄ GIT ]

STR #2215

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:3 - Applies to all machines and operating systems
Subsystem:X11
Summary:tries to look for core fonts with Xft names
Version:1.3-current
Created By:ucko.debian
Assigned To:matt
Fix Version:1.3-current (SVN: v6871)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size  
 
#1 ucko.debian
20:14 Jul 08, 2009
xft2-to-core-names.patch
2k
 
 
#2 ucko.debian
19:04 Apr 23, 2010
str2215.patch
2k
 
 
#3 ucko.debian
18:34 Nov 14, 2010
str2215-r7833.patch
1k
 
 
#4 ucko.debian
18:39 Nov 14, 2010
test-str2215.cxx
1k
 
     

Trouble Report Comments:


Name/Time/Date Text  
 
#1 ucko.debian
20:14 Jul 08, 2009
When load_xfont_for_xft2 looks for a corresponding core font, it keeps the requested face name as is, even when it is an Xft-specific alias.  I'm attaching a patch that addresses that with a (hard-coded) map, and also adjusts weight's type for const correctness.  
 
#2 matt
03:12 Sep 13, 2009
I am no Xft developer. Would someone please look over this issue and decide if the patch should be applied?

Thanks.
 
 
#3 ianmacarthur
04:42 Sep 14, 2009
I've looked at Aaron's patch before, and I think it is correct, although I'm not *entirley* sure it is necessary... The "manual" re-mapping of the well-known font names bit... Aaron reckons it is needed, for the debian builds, so I'd suggest we push it anyway.

Note that the 1.3 code for this is very slightly different, so the patch won't play as is on 1.3 (the const correctness stuff has been poked at, but in a different way.) The re-mapping of the well-known font names ought to just drop-in to the 1.3 code, and work as expected.

This is all just a hack to load some suitable font face for GL to use, so will make no difference to font handling in the "normal" case anyway.
 
 
#4 ucko.debian
17:10 Sep 14, 2009
Thanks!

The remapping won't quite drop in as is to 1.3, as assigning name = "..." will violate const correctness; I'd recommend making it (and weight) const per my patched version, but you could also cast all the literals if you'd rather go that route.

As for the actual mapping, yes, it's a kludge, and in retrospect, it might be saner to perform it based on fl_font_ rather than on name:

if (fl_fonts == built_in_table) {
    switch (fl_font_) {
    case FL_HELVETICA:
    case FL_HELVETICA_BOLD:
    case FL_HELVETICA_ITALIC:
    case FL_HELVETICA_BOLD_ITALIC:
        name = "helvetica";
        break;
    // ...
    case FL_ZAPF_DINGBATS:
        name = "zapf dingbats";
        break;
    }
}

Should I flesh that out fully and submit a revised patch?  (BTW, the name choices of course come from fl_font_x.cxx.)

At any rate, you are correct that this isn't relevant to normal usage, even if you also accept STR #2214.
 
 
#5 matt
13:34 Sep 15, 2009
Applied patch in 1.1.10. If this patch is confirmed to work, please move this STR to 1.3.  
 
#6 matt
13:04 Sep 19, 2009
New for 1.3  
 
#7 ianmacarthur
09:04 Apr 19, 2010
Aaron, if you are around... In your opinion, do we still want to bump this mod into the 1.3 tree (other GL / XLFD mods applied recently notwithstanding)?

I guess we do - but you are closer to the issue, so...

Cheers.
 
 
#8 ucko.debian
19:03 Apr 23, 2010
Yes, I'm still around, just busy, thanks in part to two young children of my own ;-).  Anyway, I can confirm with the "cube" application from tests that there is still room for improvement on this front, and have prepared an updated patch for you to review.  The patch changes the type of name and weight to const char* because I still favor that approach; if you'd rather stick to char*, you'll need to cast all the string literals assigned to name.

Thanks for your interest!
 
 
#9 matt
09:36 Oct 30, 2010
The patch is not needed. All names are listed at the beginning of src/fl_font_xft.cxx and should simply be changed there. All Linux distros I found understand the give names. If there are other Unixes that need different names, the ifdef must be changed accordingly.  
 
#10 ucko.debian
20:09 Oct 30, 2010
Perhaps I was unclear.  The usual abstract names ("serif", etc.) work great for Xft calls; however, in certain contexts, FLTK needs to be able to obtain a core X font corresponding to the current Xft font.  That's where the mapping comes in, as a typical system has core fonts matching -*-times-* but not -*-serif-*.  As such, could you please reconsider it?

Thanks!
 
 
#11 matt
13:50 Nov 14, 2010
Does this work?  
 
#12 ucko.debian
18:33 Nov 14, 2010
That's better, thanks, but I still see two problems, for which I'll post a patch shortly:
- You examine name after freeing pc, at which point it may no longer be valid.
- When trying the original name first (which is fair), you wildcard it, allowing false positives that can be somewhat far off.  I'd recommend either taking the name verbatim (per the patch I'll post) or substituting right away.
Could you please address both of those concerns?

Thanks!
 
 
#13 matt
05:10 Nov 15, 2010
OK, applied the patch  
 
#14 matt
12:28 Nov 16, 2010
Fixed in Subversion repository.  
     

Return to Bugs & Features ]

 
 

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