Closed naveen521kk closed 1 year ago
Layout
attributes.pxi
PangoLayout
convert_hex_to_rgb
Here's a small example to use this feature:
import manimpango # match the characters from index 0 to 5. attribute = manimpango.TextAttribute(0, 5) attribute.family = "Cursive" # set to a cursive font attribute.background_color = "#123456" # change background_color new_attribute = manimpango.TextAttribute(5, 10) # characters 5 to 10 new_attribute.family = "Algerian" # font layout = manimpango.Layout( "hello world", attributes=[attribute, new_attribute], font_desc=manimpango.FontDescription( family="Serif", size=30, ), ) renderer = manimpango.PNGRenderer("test.png", 1000, 100, layout) renderer.render()
This should render the following image (test.png):
test.png
Lots of other attributes which Pango provides aren't implemented yet, needs some work there.
I'll merge this once I get time to write some tests
This looks very nice. Looking forward to you finishing that. 👍
Layout
are first converted to Pango understandable attributes. This is done inattributes.pxi
file.PangoLayout
when creating theLayout
object.convert_hex_to_rgb
function to utils.Here's a small example to use this feature:
This should render the following image (![test](https://user-images.githubusercontent.com/49693820/207113217-20ad83d8-0663-4d3e-b75c-ddef4b703d86.png)
test.png
):Lots of other attributes which Pango provides aren't implemented yet, needs some work there.