mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
use FontPool for loading fonts
This commit is contained in:
parent
e55a5136af
commit
da894b0561
@ -145,28 +145,11 @@ class Loader:
|
|||||||
if phaseChecker:
|
if phaseChecker:
|
||||||
phaseChecker(modelPath)
|
phaseChecker(modelPath)
|
||||||
|
|
||||||
# Check the filename extension.
|
font = FontPool.loadFont(modelPath)
|
||||||
fn = Filename(modelPath)
|
if font == None:
|
||||||
extension = fn.getExtension()
|
# If we couldn't load the model, at least return an
|
||||||
|
# empty font.
|
||||||
if extension == "" or extension == "egg" or extension == "bam":
|
font = StaticTextFont(PandaNode("empty"))
|
||||||
# A traditional model file is probably an old-style,
|
|
||||||
# static font.
|
|
||||||
node = ModelPool.loadModel(modelPath)
|
|
||||||
if node == None:
|
|
||||||
# If we couldn't load the model, at least return an
|
|
||||||
# empty font.
|
|
||||||
font = StaticTextFont(PandaNode("empty"))
|
|
||||||
else:
|
|
||||||
# Create a temp node path so you can adjust priorities
|
|
||||||
nodePath = NodePath(node)
|
|
||||||
nodePath.adjustAllPriorities(priority)
|
|
||||||
# Now create the text font from the node
|
|
||||||
font = StaticTextFont(node)
|
|
||||||
else:
|
|
||||||
# Otherwise, it must be a new-style, dynamic font. Maybe
|
|
||||||
# it's just a TTF file or something.
|
|
||||||
font = DynamicTextFont(fn, faceIndex)
|
|
||||||
|
|
||||||
# The following properties may only be set for dynamic fonts.
|
# The following properties may only be set for dynamic fonts.
|
||||||
if hasattr(font, "setPointSize"):
|
if hasattr(font, "setPointSize"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user