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

Re: auto-scaling text dia .94



Hi all,

On Wed, 20 Oct 2004, Tomas Mezger wrote:

> i'm usig dia .94 under kde and FC2.
...
> i'm having a big problem with text in dia, because dia resizes the text
> as he whants... sometimes i only have a very tiny text and if i add a
> space on the text, it returns to the normal size. if i remove the space,
> it is tiny again.

I have the same problem using dia 0.94 on Windows XP using the binaries
from http://dia-installer.sourceforge.net/
and also with a version I have compiled myself from CVS
(DIA_0_94 tag).

I can always reproduce the problem by following these steps:

1. Start dia
2. Create a new diagram
3. Zoom in to 200 %
4. Add a flowchart symbol, for example a process (box)
5. Add the following two letters: ad

When I type the first letter in step 5, the a is shown in the correct
size. When I then type d, the text is shrunk to half the size. Adding some
other letters then makes the text normal size again. The choice of letters
is important and also depends on the zoom level, for example at 400 % zoom
I have to type adf for the problem to appear.

As far as I can see from my very limited knowledge of the dia sources and
some gdb:ing, the problem seems to be with the layout cache used by
dia_font_build_layout. The cache only stores a reference to the font
object used to create the layout, but it may be modified by subsequent
calls to dia_font_build_layout with different heights so that font->pfd
no longer matches the cached layout.

Example, end of dia_font_build_layout (string=0x14630c8 "ad",
    font=0x13ea240, height=1.6000000000000001), font.c:
(gdb) n
638           return cached->layout;
(gdb) p *cached->font->pfd
$52 = {family_name = 0x14f28c0 "sans", style = PANGO_STYLE_NORMAL,
  variant = PANGO_VARIANT_NORMAL, weight = PANGO_WEIGHT_NORMAL,
  stretch = PANGO_STRETCH_NORMAL, mask = 43, static_family = 0, size =
22937}
(gdb) p *((PangoAttrFontDesc
*)cached->layout->attrs->attributes->data)->desc
$53 = {family_name = 0x14f0658 "sans", style = PANGO_STYLE_NORMAL,
  variant = PANGO_VARIANT_NORMAL, weight = PANGO_WEIGHT_NORMAL,
  stretch = PANGO_STRETCH_NORMAL, mask = 43, static_family = 0, size =
11468}
(gdb)

A solution which appears to work in a brief test is to replace the
dia_font_ref call in dia_font_build_layout by
    item->font = dia_font_copy(font);

but I don't know if this is the right way to do it or not.
Reverting to rev 1.122 of lib/font.c also seems to make this problem go
away, but probably unfixes other bugs.

Btw, thanks for a great program!

Regards
Robert Ögren


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK