Skip to content

How to create a table cell with text of different color? #1397

Answered by Lucas-C
JSchoeck asked this question in Q&A
Discussion options

You must be logged in to vote

Oh alright, I didn't quite understand what you were trying to achieve, sorry 😅

Support for ANSI escape characters, is an interesting idea,
and yes it would allow to color fragments of text in a single cell in different shades.

And yes, it should be implemented at the FPDF._render_styled_text_line() level,
but also beforehand in fpdf.line_break when parsing lines into TextLine & Fragment objects.

A Fragment already has a .graphics_state attribute that contains its text_color.

Is this something that you would be interested on working on @JSchoeck? 🙂

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@JSchoeck
Comment options

@Lucas-C
Comment options

Answer selected by JSchoeck
@JSchoeck
Comment options

@Lucas-C
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants