image_mask().
(swapColors): new function to convert colors from ARGB order into RGBA
(big-endian systems) or BGRA (little-endian systems).
(_createAppIconPixmaps): use swapColors() and remove unused code.
(restrictWindow:toImage:): use alphaMaskForImage().
(imagecursor:::): use swapColors() and remove unused code.
off-by-one mistake during alpha handling. Enable disabled code and
remove temprorary one.
(window::::): set NetWM icon to window for all EWMH capable WMs even
it's WindowMaker.
(image_mask): new function to create alpha mask for image. It's based
on xgps_cursor_mask() code with additional argument `alpha_treshold`.
This function may be used for images (alpha_treshold == 0) with real
alpha mask and for cursors (if no Xcursor library is used - no alpha
is used, no shadows in cursors, alpha_treshold == 158 is used to cut
transparent pixels).
(_createAppIconPixmaps): icon pixmap creation rewritten to support
images with alpha channel using wraster functions. Use image_mask().
(restrictWindow:toImage:): use image_mask() instead of
xgps_cursor_mask().
(xgps_cursor_mask): removed as image_mask() replaced it.
Guard xgps_cursor_image( with #if - will not be compiled if Xcursor
is used.
(imagecursor:::): use image_mask() instead of xgps_cursor_mask().
to _convertToFormatBitsPerSample::::::::. Fixes display of colored
mouse cursor images.
(standardcursor::): cleanup in Xlib cursors handling. Additional
cursor types were added: GSClosedHandCursor, GSOpenHandCursor.
Removed GSDisappearingItemCursor type handling - it loads in NSCursor
from image.
and setups observer for defaults changes.
(mouseOptionsChanged:): new method. Read mouse properties from user defaults.
(processEvent:): respect mouse options on ButtonPress and ButtonRelease events.
* Source/x11/XGServer.m (dealloc): remove notification observer.
There's no good reason not to enable subpixel rendering and hinting.
Leaving it off makes GNUstep apps look worse than everything else, in
exchange for having -advancementForGlyph: be totally consistent, which
may not even be necessary.
So, yeah, let's just turn this stuff on. I reused the subpixel default
from back-art to preserve configs, and added a GSFontHinting default to
control text hinting.
Use 0 for whatever Cairo defaults to, 1 for off, 2 for slight hinting,
3 for medium hinting, or 4 for full hinting.
Some simple code for getting access to the main SFNT tables used for
drawing the right glyphs in the right ways. It's hidden with an "#if 0" for
future use.
Implement a method for accessing named glyphs and character codings from
Cairo.
This is a necessary first step for complex glyph substitution, and even
simple things like standard ligatures.
Rather than sorting fonts by the integer value of "traits", let's sort by
the traits we are looking for specifically. Again, like many other things,
totally correct handling of this stuff will have to wait for a good method
of inspecting and correctly processing SFNT tables.
Fontconfig's font weights are almost but not entirely defined by the
constants found in its source code. Things like FC_WEIGHT_LIGHT are not,
as we had presumed, a list of definitive weights. As such, it seems there
are a goodly number of fonts that have weights not appearing in the list.
For example, say there's a font that is heavier than Medium (weight 100 for
fontconfig, and 6 for us) but not as heavy as Demibold (FC: 180, GS: 7),
then it might tell Fontconfig it has a weight of 130.
When this happens, we _could_ assign its NSWeight to be 6 or 7, but it's
possible that there will be another face in that font that ALSO fits there,
which might throw off the sorting. Instead, what I suggest is to do what
I have done...assign an NSWeight with a weight class that represents the
numeric distance _between_ the two defined values.
So the GS weight for this font face becomes something like:
NSWeight = 6 + ((FCWeight - Medium) * (1.0 / (Demibold - Medium)))
or, in numeric terms, 6 + 0.375
In service of this change, I have switched the actual Weight value within
the font dictionary from int to float. This is an attempt to translate this
situation into a sortable form we can work with, compressing an approximate
range of possible FC font weights into our 0-15 system.
There may well be a better way to go about this, such as figuring out where
fontconfig gets this info in the first place and converting from the source
directly, but accessing the SFNT tables (which will almost certainly be
required) is something for a later day.
Can't use fullname ALL the time, because some (mostly Adobe) fonts store
a duplicate of their PostScript name in the fullname field (and for that
case, we can just do what we already did), but it works well for just about
everything else.
GNUstep's font architecture makes it extremely difficult and annoying to
have a properly sorted font panel (or even one that makes any sense at all).
This might not be the best place to implement font sorting, but I'll be
damned if I can find a better one. The font enumerator knows where to look,
and has all the information needed to do it.
So, once we've enumerated all the fonts, sort them with a function that's
only slightly more clever than alphabetizing them. We sort by these
criteria, in order of importance:
1. font weight
2. traits (numeric ordering)
3. style name, with special cases so "Regular"/"Normal"/"Roman" sort
earlier than other stuff (caption, titling, etc.)
This sorting function seems to work about as well as can be expected,
producing the obvious "Regular"/"Italic"/"Bold"/"Bold Italic" for
undemanding families, while getting more advanced ones (like, say, the 168
font faces of Kepler Std) pretty close.
GNUstep has been bending over backwards to deal with fontconfig's baffling
lack of support for PostScript-style font names, just as it bent over
backwards to deal with XLFD's lack of same. Luckily, the fontconfig guys
have done us (and let's be honest, ghostscript and every pdf reader in
creation) a solid, and now that it's here it would be downright criminal
to not use it.
Implement it. :)