[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]DrawString good and bad news.... / Freetype

From: Thomas Fritzsche
Subject: [DotGNU]DrawString good and bad news.... / Freetype
Date: Mon, 29 Sep 2003 09:05:43 -0000 (UTC)
User-agent: SquirrelMail/1.4.0

Hi Neil+dotgnu-hackers,

I reimplemented the word-wrap algorithem, so that it now wraps strings on
the level of words. The reason for this was:

1. reduce the number of pinvoke calls
2. if the Toolkit implements kerning we should not work whith single letters.

The good news: It's not perfect but I have a running "basis" algorithem.

The bad news: For some unknown reason it is very slow. But I have nearly
100% idle time, so I guess that is not caused by the overhead of my new
word wrap algorithem. Is it possible that this is caused by the pinvoked
StringMeasure functions???
Are there any tools in dotgnu to make some performence checks to see where
all the time is lost?


Other question: in the current Xsharp toolkit you use normal X-calls for
the font stuff or Xft (didn't compile on my installation).

I'm now thinking about a direct freetype interface.
 - more control of the font metric etc.
 - same output on every os
 - quality
 - no calls to the slow X font system

 - we create a new independend font system
 - we need a fast method to draw the rendered text

How far is the C-Support of the dotgnu system? Is it possible to compile
freetype with it to get clean il-code? Is the ilrun fast engough?

I made some additional checks whith the windows SWF/SWD. If you use
DrawString without StringFormat the method uses word wrap.

Here is some code from the dotgnu-tree implementation:
if (drawing)
        node.heirarchyMarkerBounds = new Rectangle(x, y , indent - 6, 
        DrawHeirarchyMarker(g, node);
        node.bounds.Size = g.MeasureString(node.Text, Font).ToSize();
        node.bounds.Location = new Point(x + indent, y + 1);
        if (node == selectedNode && Focused)
                g.DrawString(node.Text, Font, SystemBrushes.HighlightText, 

You first measure the string and then you use the DrawString method whith
precise this size and no StringFormat. But precise this size is to small
you need a bigger size(or nowrap format, which is also faster)!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]