ofxPango

Hi!

I’m working with texts using ofxPango it works great but I’m in troubles changing the properties of a created layout.

I create the objects in the same way of the included example:

  
  
    pango = new ofxPango;  
    context = pango->createContextWithSurface(400.0, 50.0);  
    context->color4f(1.0f, 1.0f, 1.0f, 0.0f);  
    context->paint();  
  
    layout = context->createPangoLayout();  
    layout->setText("text");  
    layout->setWidth(400.0);  
    layout->setJustify(true);  
    context->color4f(0.22f, 0.65f, 0.97f, 1.0f);  
  
    fontDescription = new ofxPCPangoFontDescription();  
    fontDescription->createFromString("Presidencia Base Regular 20");  
    layout->setFontDescription(*fontDescription);  
    layout->show();  
  
    text_image.allocate(context->getSurface()->getWidth(), context->getSurface()->getHeight(), OF_IMAGE_COLOR_ALPHA);  
    text_image.setFromPixels(context->getSurface()->getPixels(), text_image.width, text_image.height, OF_IMAGE_COLOR_ALPHA, true);    
  

and later on, I’m trying to modify things like the text color and the size and font in this way:

  
  
    layout->setTextColor(tR, tG, tB, tA);  
    layout->show();  
    text_image.setFromPixels(context->getSurface()->getPixels(), text_image.width, text_image.height, OF_IMAGE_COLOR_ALPHA, true);  
  

In this way the text properties are modified, but the image rendered keeps the last state before the transformation, so the new image does not erase the first rendered text no matter if I use the clear method of ofImage before make the tranformation.

Any one have a clue on how to solve this?

Thanks!

zea

hi,

anyone have a working example using ofxPango in 007 ?
i’ve tried pulling the latest from => https://github.com/roxlu/ofxPango
but the current mac example compiles with a bunch of errors.

thx,
Lukasz.

I made a working linux64 example here: https://github.com/roxlu/ofxPango/pull/5

maybe this helps.

ben

I’m also encountering many errors trying to compile on Xcode (4.6.3/OSX 10.8.5). Any pointers would be really helpful! Also – will this add-on run under Android/iOS?

brad

Has anyone success running ofxPango with OF_v8.0 and XCode v5.0.2?
I tried to run with OS X SDK 10.9,10.8 and also with 10.6.
but no success.