-
Hello - using fpdf2 after transitioning from the original project and going well in most use cases, but I have a need to output some subscript/superscript characters - is there a way to do this within a cell for example? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @gumbald Sadly there is currently no simple way to render subscript/superscript using In the meantime, you may have to rely on a manual approach similar to this code: pdf = FPDF(format="letter", unit="pt")
pdf.add_page()
pdf.set_font("helvetica", size=36)
pdf.cell(border="TBL", txt="Lorem ipsum")
x, y = pdf.x, pdf.y
pdf.cell(border="TBR", txt=" nostrud irure")
pdf.set_font_size(20)
pdf.set_xy(x, y)
pdf.cell(txt="Sup")
pdf.set_xy(x, y+20)
pdf.cell(txt="Sub")
pdf.output("discuss_298.pdf") |
Beta Was this translation helpful? Give feedback.
-
@gumbald, if you're happy with digits and a subset of ASCII chars, then there's a rather simple solution: Unicode subscripts and superscripts As you'll see on that page, not all characters are actually covered, not all of them are supported by most fonts, and some fonts don't style them consistently. They are also scattered all over the place in various Unicode blocks. But for many practical purposes they still work, and fpdf2 has no problems including them in a file. |
Beta Was this translation helpful? Give feedback.
-
This is being implemented by @gmischler in PR #520 and will be released soon |
Beta Was this translation helpful? Give feedback.
Hi @gumbald
Sadly there is currently no simple way to render subscript/superscript using
fpdf2
...This could a useful feature to add!
In the meantime, you may have to rely on a manual approach similar to this code: