]> git.lyx.org Git - features.git/commitdiff
Document symbol fonts hack (text from Georg Baum).
authorAbdelrazak Younes <younes@lyx.org>
Mon, 26 Feb 2007 16:22:54 +0000 (16:22 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 26 Feb 2007 16:22:54 +0000 (16:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17368 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiFontMetrics.C
src/frontends/qt4/QLPainter.C

index ca696d3e391a4f1272603492cb883dbb073ed5b1..9726bb0a31869318fb922224db365bf5f9854819 100644 (file)
@@ -93,6 +93,10 @@ int GuiFontMetrics::width(docstring const & s) const
        }
 
        if (smallcaps_shape_)
+               // Caution: The following ucs4 to QString conversions work
+               // for symbol fonts only because they are no real conversions
+               // but simple casts in reality. See comment in QLPainter::text()
+               // for more explanation.
                return smallcapsWidth(toqstr(s));
 
        int w = 0;
index c7e0f7f811d774d2aa929ac51a0ca417e39e8708..9e76264bf2e72efcd29c913ca29a26ea225f0692 100644 (file)
@@ -207,6 +207,17 @@ int QLPainter::smallCapsText(int x, int y,
 int QLPainter::text(int x, int y, docstring const & s,
                LyXFont const & f)
 {
+       /* Caution: The following ucs4 to QString conversions work for symbol fonts
+       only because they are no real conversions but simple casts in reality.
+       When we want to draw a symbol or calculate the metrics we pass the position
+       of the symbol in the font (as given in lib/symbols) as a char_type to the
+       frontend. This is just wrong, because the symbol is no UCS4 character at
+       all. You can think of this number as the code point of the symbol in a
+       custom symbol encoding. It works because this char_type is lateron again
+       interpreted as a position in the font again.
+       The correct solution would be to have extra functions for symbols, but that
+       would require to duplicate a lot of frontend and mathed support code.
+       */
        QString str = toqstr(s);
 
 #if 0