I’ve just encountered a bit of an odd issue: When a higher-than-default point-size is applied to a DynamicTextFont (such as for rendering crisp text at large sizes), text rendered with that font becomes squashed together, both vertically and in its horizontal space-characters.
To illustrate, here below is a screenshot of a simple test-program, showing two pieces of text, both displayed via DirectLabels, and both employing the same font.
The left-hand piece of text uses a DynamicTextFont with no point-size set (and is thus a little blurry). The right-hand piece of text uses a DynamicTextFont with a point-size of 24 set. The left-hand label has a larger scale and a smaller word-wrap value, in order that its text more-or-less match that of the right-hand label in letter-size and line-length.
And here is the program that generated the above. (Presuming that you don’t have the referenced font, just replace the name of the font-file with one that you do have.)
from direct.showbase.ShowBase import ShowBase
from panda3d.core import DynamicTextFont
from direct.gui.DirectGui import *
from panda3d import __version__ as pandaVersion
print (pandaVersion)
import sys
print (sys.version)
class Game(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.accept("escape", base.userExit)
font = DynamicTextFont("Aileron-Regular.otf", 0)
font.setPointSize(24)
font2 = DynamicTextFont("Aileron-Regular.otf", 0)
mew = DirectLabel(text = "This is a longish text, designed to see how DirectLabel handles both spaces and multiple lines",
scale = 0.07,
text_font = font,
text_wordwrap = 15,
pos = (0.6, 0, 0.5)
)
mew2 = DirectLabel(text = "This is a longish text, designed to see how DirectLabel handles both spaces and multiple lines",
scale = 0.168,
text_font = font2,
text_wordwrap = 7,
pos = (-0.6, 0, 0.5)
)
app = Game()
app.run()
I’ve observed this issue with more than one font, I believe, so it doesn’t seem to be specific to the font being used.
Am I misusing my font-objects in some way? Or is this an engine issue?