[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: karbon, kpainter and kword
From:       David Faure <dfaure () klaralvdalens-datakonsult ! se>
Date:       2003-06-17 14:15:48
[Download RAW message or body]

On Tuesday 17 June 2003 16:22, Dirk Schönberger wrote:
> > KWord needs to find out where a sentence breaks on the page. Or in other
> > words; how much text (glyphs) fit in x milimeters.

Well, KoTextFormatter looks at the width of each char, and decides that on its own.
I don't think this is the job of the renderer (KPainter). All we need is metrics.

> 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?

Not necessarily. I could pass a transformation matrix that transforms the outline
so that it fits horizontally (i.e. a horizontal zoom factor).

> > 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?

Yes, metrics are enough.

> > 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?

Not sure how to obtain the glyph number, but I guess so.

> > 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.

Doesn't matter - his idea (passing a rect) is like mine (passing a matrix):
in both cases it's about scaling the outline so that it takes the desired width and height.

-- 
David Faure -- faure@kde.org, dfaure@klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions
_______________________________________________
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