-
Notifications
You must be signed in to change notification settings - Fork 118
Conversation
We remove a whole `cond' from the code block, because size is never NIL (it is preset a few lines earlier). We leave a comment to remember that during the further refactoring.
Setting size doesn't require lexical scope containing display, so we can move it earlier.
Separate `find-font' into two smaller functions.
Our autodetection facilities rely either on looking for TTF/ directory or on fc-match. They return relative and absolute pathnames accordingly. This commit fixes handling of them. Related to #75.
Add text-style to the message, so the user may verify which font can't be found (NIL filename doesn't give us much information).
We've used `T', which isn't the right thing to use here.
Abstract `font-acent', `font-descent', `font-glyph-width', `font-text-extents' and `font-draw-glphs' so we can work on both truetype fonts and the ordinary fonts provided by X server (extension specializes on different font type). Font access will be wrapped in a protocol for truetype (and possibly other) extensions.
Now that we have unified `font-text-extents', so there is no need to redefine the method `text-bounding-rectangle' (body is exactly the same).
Both implementations from truetype and clx/ugly were practically the same (except a few optimizations to the former). Backported optimizations and removed truetype one.
Both implementations now are thread-safe (we have lock around the drawing function) and have additional optimizations. Except that they are should behave same as before.
Move the dummy case one level up and use return-from there.
If we can't find requested style in our registered TTF fonts, we try to find them among CLX native fonts.
If the fallback returns NIL (so we don't have such mapping), signal a MISSING-FONT condition.
I think it might be used in the past, or was planned to be used in the future, but for now it's just a non-exported interface which isn't used whoatsoever.
Variable *clx-text-sizes* from clim-clx was duplicated in ttf extensions under the name *sizes*. Remove the duplication.
native clx backend text-style-mapping stored (font-name . font) in the text-style unnecessarily, while xrender-ttf extension just holds there font-value. Unify that.
native clx backend text-style-mapping was searching for the requested font and this was used by text-style-to-X-font. On the other hand ttf extension was searching for the font in text-style-to-X-font. We have unified that and text-style-mapping is the same thing for both implementations now.
We did triple-checking, first in the hashtable, the second one in the lookaside variable and the third one in the second hashtable. Unify behaviour with clx backend which does only one check now.
Use similar pattern as used in text-style-to-X-font in xrender-fonts ttf extension.
use ensure-gethash idiom
Separate font configuration from xrender-fonts. Also add default path search which doesn't require shelling out.
Previously slot was unbound on creation.
Previously we only cached basic text-styles. We cache it to ensure EQL on the same extended styles (family/face designators may be strings or other kinds of objects).
This class has slots for size and other details, hence it is a font not a face, which only denotes how it looks like. Next commits will introduce truetype-face as a separate class.
There is another library, clx-truetype, that does antialiased TTF font rendering for CLX. Was this looked at? Rendering using that library tends to perform terribly, so I wonder how the implementation here compares. |
xrender-fonts takes care of glueing it, but mcclim-native-ttf is now reusable.
We have calculated some parameters in make-truetype-font while they could be (and should) initialized during object creation.
add register-ttf-fonts function to fontconfig which registers all *.ttf files which may be read by zpb
move register-ttf-fonts function to xrender-fonts, because it is indeed xrender-fonts specific at the moment.
c067b5a
to
0885038
Compare
dkochmanski:
|
Looks to me that Alexandria is referenced in package.lisp in an |
yes, that was me being sloppy, thanks! (last commit fixes this) |
@jorams I wasn't aware about that, will check it for sure. Thanks. |
@jorams, @dkochmanski - it seems that neither McCLIM nor clx-truetype render fonts using sub-pixel antialiasing that makes all the difference visually. This compares McCLIM's font selector demo font with my emacs font (Make sure your browser is not zooming - in firefox, and magnified Note the top pixel line of the non-rgb antialiased font makes it look really unfortunate... I am trying to figure it out... xrender supports it... OK, CLX-TRUETYPE officially does not support it:
CL-CAIRO2 does not seem to do RGB subpixel, or at least I could not coax it to do so. |
XRender is an extension which we use to draw fonts ourself (using cl-vectors etc.). Excerpt from the McCLIM truetype extension readme: TODO
Wish-list
|
Refactor CLX fonts and TTF extension