[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: karbon, kpainter and kword
From: "Dirk Schönberger" <dirk.schoenberger () sz-online ! de>
Date: 2003-06-17 14:22:51
[Download RAW message or body]
Thomas Zander schreibt:
> On Tue, Jun 17, 2003 at 12:37:22PM +0000, Dirk Sch?nberger wrote:
> > I have left text support out of KPainter because I wasn't sure about the
> > requirements.
> > Would it be ok if we collect the requirements and I implement a first
> > version incl. the frontend / backend communication operators.
> > After that we could see how this API could be implemented by the KPainter
> > backends.
> >
> > > 1) give me the width (+ height and baseline) of an "A" in font foo size
> > > 12pt (with decimals, not just in pixels)
> >
> > something like
> >
> > KFontMetric &fontMetrics (QString &string);
> > KFontMetric &fontMetrics (QChar &string);
>
> The real thing needed for the painter is a bit more high-level that might
> give different low-level specs.
>
> KWord needs to find out where a sentence breaks on the page. Or in other
> words; how much text (glyphs) fit in x milimeters.
That's why I introduced text model in my design ideas. a text model managed
the conversion of a high level text description (e.g. simple text or KWord)
into a set of KPainter calls (drawGlyph, drawString, drawChar).
It uses its own metrics, but it can also use KPainter generated metrics for
real fonts.
>
> This sounds similar, but it is not.
> Anyone familiar with TeX recongnizes the last solution since it is what gives
> TeX the power to insert a word somewhere on the page without making the
> paragraph take an extra line; they just 'shrink' the font a little bit over
> the horizontal line.
But this means you need the actual font outline in the text model, no?
>
> Anyway; to render fonts in KWord correctly I think the following approuch
> should be taken:
>
> 1) take a big line (paragraph of QtRT) and a rectangle (in mm) and ask the
> painter where the line would break.
or the font metrics?
> 2) repeat for rest of paragraph.
>
> Using the line-breakings data-structure for painting.
>
> 1) Give array of glyphs and size (in pixels) to the renderer for painting.
drawGlyph() calls?
> 2) KPainter figures out what size (in pixels) the string is and scales the
> text horizontally and vertically (both, but independend) to make it fit. [1]
If you call drawGlyph(), KPainter doesn't know anymore that it is supposed
to render a text string.
Regards
Dirk
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic