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