Re: font selection/searching

Marc Strämke <[email protected]> Fri, 10 Oct 2003 15:06:54 +0200
Newsgroups gmane.comp.embedded.stk.gui.devel
Message-ID <[email protected]>
Marc Strämke wrote:
> Vernon Mauery wrote:
> 
>> dvhart and I talked about some about the fonts after leaving
>> linux-coding and this is what I have decided to implement:
>>
>> font::font(const font_properties& prop)
>>
>> the constructor looks for the fontname*.ttf listed in the
>> font_properties object in the fontpath that configure supplies.  Then,
>> it goes through each file looking for a face that matches the the
>> bold/italic style settings and returns the first font that it finds.
> 
> Has one small problem left, vera and veramono for example share the same 
> suffix but are different fonts, so you have to search for the shortest 
> matching font
Sorry, this should read prefix, not suffix
> 
>>
>> If that font is not existant, what should we do?  Default to vera?
>> Default to vera with the specified style? Throw an exception? 
>> My personal opinion is that we should default to vera with the style
>> that they wanted and only throw an exception if vera is not found. 
>> We decided that Monospace/Serif/Sans Serif should not be flags, but the
>> user should specify a filename that gives them the family name they
>> want.  For example, if you want a monospace font, choose Courier, not
>> Arial.  Or if you want Sans Serif, choose Vera, not Times.
>>
>> Since most fonts we have found and use keep the filename similar for a
>> group of fonts (Arial, Arial Bold, Arial Italic, etc.) we can simply do
>> a non case compare for arial to get the right family.
>>
>> Is this good for everyone else?  Reply soon because I am currently
>> implementing it. :)
> 
> Couldnt reply sooner (time difference you know?) :)