Hi Felipe, thanks for the reply.
>> I'm using the Pango bindings with Gtk2Hs to render some text. I've
>> been scaling the "Render" context with an arbitrary factor before
>> rendering and everything seemed to work fine until I mixed in some
>> uppercase letters with my lowercase.
>> Now, if (for example) I try to write the string "Pair", then the "air"
>> substring is drawn increasingly on top of the "P" as the scaling
>> factor increases. I've giving the whole string to Pango to render; I'm
>> calling layoutSetText and then showLayout.
> I've never seen this problem. However, I guess you should be using
> updateContext and then layoutContextChanged before showLayout.
I'm (presumably rather inefficiently, but hopefully correctly)
creating a new PangoContext and PangoLayout every time I want to
render a string, using createLayout. So, the possiblity of the context
having changed, or the layout needing to be updated, should not arise,
assuming it's valid to take this excessively redundant approach. My
string-drawing code looks like:
drawStr ∷ String → Render ()
drawStr str = do
fontDesc ← font
layout ← createLayout ""
liftIO $ do
layoutSetFontDescription layout $ Just fontDesc
layoutSetText layout str
(I don't know what the string argument to createLayout is for, so I
just pass the empty string.)
The problem only arises when I prepend, to my top-level Render action,
the action "scale x x" (from Graphics.Rendering.Cairo) with x >1; if
x=1, everything looks fine. Also, the problem affects different fonts
Any further ideas/suggestions welcome :)