>  "fixed-width" vs "variable-width" is a better option... 

Well, even so called monospaced fonts are not fixed width if [wide Unicode 
characters](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) are 
present.

> some font families don't contain "normal" faces,

Maybe just skip them, any syntactic entity identified by bolding or italics 
will not be distinguishable with those fonts, only show them when "all" is 
selected.

>  "normal" style/weight (IF any present for the particular family) appears 
> before fonts with bold/slanted etc style/weight.

The ordering of fonts in my chooser generally follows that rule, but not 
always, eg Freeserif goes Bold Italic, Italic, Regular, Bold.  Since I suspect 
the ordering in the chooser is the same as the enumeration from Pango this 
would indicate that may not be a good assumption.  If its not documented to be 
in that order you can't assume it.

> I have included the filtering out of the unneeded faces/styles in the same 
> function that filters based on checking-state of the buttons.

Thats the way to do it, the cost of filtering will be insignificant compared to 
the cost of the chooser loading and rendering its sample text in every font 
available.

There is no way to make the standard dialogs use a list of fonts you have 
compiled, they will always consult the platforms font machinery, which can vary 
between platforms (win, lin, osx) and sometimes on the platform for different 
font types, eg True Type vs Open Type vs Adobe fonts.  This is the correct 
method since your list will not reflect fonts installed later.  Just forget 
about trying to optimise it, first get it right, then optimise if needed.

Havn't looked at your code in detail since you need to adjust your algorithm on 
the basis that regular won't always be first.  However the basic idea of the 
filter function passed the button state via the user data is correct.  A note 
on the user data, don't use fixed lengths for strings, someone will always 
overflow it, use dynamic strings.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1928#issuecomment-416015101

Reply via email to