mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
use FontPool for loading fonts
This commit is contained in:
parent
e55a5136af
commit
da894b0561
@ -145,28 +145,11 @@ class Loader:
|
||||
if phaseChecker:
|
||||
phaseChecker(modelPath)
|
||||
|
||||
# Check the filename extension.
|
||||
fn = Filename(modelPath)
|
||||
extension = fn.getExtension()
|
||||
|
||||
if extension == "" or extension == "egg" or extension == "bam":
|
||||
# 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)
|
||||
font = FontPool.loadFont(modelPath)
|
||||
if font == None:
|
||||
# If we couldn't load the model, at least return an
|
||||
# empty font.
|
||||
font = StaticTextFont(PandaNode("empty"))
|
||||
|
||||
# The following properties may only be set for dynamic fonts.
|
||||
if hasattr(font, "setPointSize"):
|
||||
|
Loading…
x
Reference in New Issue
Block a user