From a7d8653a467cddb294a66d3eb3daae246384660c Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 26 Feb 2007 16:22:54 +0000 Subject: [PATCH] Document symbol fonts hack (text from Georg Baum). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17368 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiFontMetrics.C | 4 ++++ src/frontends/qt4/QLPainter.C | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/frontends/qt4/GuiFontMetrics.C b/src/frontends/qt4/GuiFontMetrics.C index ca696d3e39..9726bb0a31 100644 --- a/src/frontends/qt4/GuiFontMetrics.C +++ b/src/frontends/qt4/GuiFontMetrics.C @@ -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; diff --git a/src/frontends/qt4/QLPainter.C b/src/frontends/qt4/QLPainter.C index c7e0f7f811..9e76264bf2 100644 --- a/src/frontends/qt4/QLPainter.C +++ b/src/frontends/qt4/QLPainter.C @@ -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 -- 2.39.2