mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
loadFont(outline=xxx)
This commit is contained in:
parent
89aeadbc72
commit
3b793cf964
@ -295,6 +295,7 @@ class Loader(DirectObject):
|
||||
textureMargin = None, polyMargin = None,
|
||||
minFilter = None, magFilter = None,
|
||||
anisotropicDegree = None,
|
||||
outline = None,
|
||||
lineHeight = None, okMissing = False):
|
||||
"""
|
||||
modelPath is a string.
|
||||
@ -304,6 +305,17 @@ class Loader(DirectObject):
|
||||
egg file (or bam file) generated with egg-mkfont, or a
|
||||
standard font file (like a TTF file) that is supported by
|
||||
FreeType.
|
||||
|
||||
Most font-customization parameters accepted by this method
|
||||
(except lineHeight and spaceAdvance) may only be specified for
|
||||
font files like TTF files, not for static egg files.
|
||||
|
||||
If outline is not None, it may be either a single number,
|
||||
representing the desired outline width (in font pixels), or it
|
||||
may be a 2-tuple of (width, feather), where feather is a
|
||||
number in the range 0.0 to 1.0 and indicates the softness of
|
||||
the outline.
|
||||
|
||||
"""
|
||||
assert Loader.notify.debug("Loading font: %s" % (modelPath))
|
||||
if phaseChecker:
|
||||
@ -336,6 +348,18 @@ class Loader(DirectObject):
|
||||
font.setMagfilter(magFilter)
|
||||
if anisotropicDegree != None:
|
||||
font.setAnisotropicDegree(anisotropicDegree)
|
||||
if outline != None:
|
||||
# Outline should be a float: width
|
||||
# or a 2-tuple: (width, feather)
|
||||
try:
|
||||
outline = tuple(outline)
|
||||
except TypeError:
|
||||
outline = (outline,)
|
||||
if len(outline) < 2:
|
||||
outline = (outline[0], 0.1)
|
||||
font.setOutline(VBase4(0, 0, 0, 1), *outline)
|
||||
# This means we also want the bg to be black.
|
||||
font.setBg(VBase4(0, 0, 0, 0))
|
||||
|
||||
if lineHeight is not None:
|
||||
# If the line height is specified, it overrides whatever
|
||||
|
Loading…
x
Reference in New Issue
Block a user