Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Foss2023 1 Final
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ju Hee Son
Foss2023 1 Final
Commits
46c7d1bd
Commit
46c7d1bd
authored
2 years ago
by
Ju Hee Son
Browse files
Options
Downloads
Patches
Plain Diff
Add new file
parent
bd64bf5b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
3. 독립형 모듈/3.4 font drawing(blf)
+140
-0
140 additions, 0 deletions
3. 독립형 모듈/3.4 font drawing(blf)
with
140 additions
and
0 deletions
3. 독립형 모듈/3.4 font drawing(blf)
0 → 100644
+
140
−
0
View file @
46c7d1bd
Font Drawing (blf)
This module provides access to Blender’s text drawing functions.
Hello World Text Example
Example of using the blf module. For this module to work we need to use the OpenGL wrapper bgl as well.
blf.dimensions(fontid, text)
Return the width and height of the text.
Parameters
fontid (int) – The id of the typeface as returned by blf.load(), for default font use 0.
text (string) – the text to draw.
Returns
the width and height of the text.
Return type
tuple of 2 floats
blf.disable(fontid, option)
Disable option.
Parameters
fontid (int) – The id of the typeface as returned by blf.load(), for default font use 0.
option (int) – One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.
blf.draw(fontid, text)
Draw text in the current context.
Parameters
fontid (int) – The id of the typeface as returned by blf.load(), for default font use 0.
text (string) – the text to draw.
blf.enable(fontid, option)
Enable option.
Parameters
fontid (int) – The id of the typeface as returned by blf.load(), for default font use 0.
option (int) – One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.
blf.load(filepath)
Load a new font.
Parameters
filepath (string) – the filepath of the font.
Returns
the new font’s fontid or -1 if there was an error.
Return type
integer
blf.position(fontid, x, y, z)
Set the position for drawing text.
Parameters
fontid (int) – The id of the typeface as returned by blf.load(), for default font use 0.
x (float) – X axis position to draw the text.
y (float) – Y axis position to draw the text.
z (float) – Z axis position to draw the text.
blf.rotation(fontid, angle)
Set the text rotation angle, enable/disable using ROTATION.
Parameters
fontid (int) – The id of the typeface as returned by blf.load(), for default font use 0.
angle (float) – The angle for text drawing to use.
blf.shadow(fontid, level, r, g, b, a)
Shadow options, enable/disable using SHADOW .
Parameters
fontid (int) – The id of the typeface as returned by blf.load(), for default font use 0.
level (int) – The blur level, can be 3, 5 or 0.
r (float) – Shadow color (red channel 0.0 - 1.0).
g (float) – Shadow color (green channel 0.0 - 1.0).
b (float) – Shadow color (blue channel 0.0 - 1.0).
a (float) – Shadow color (alpha channel 0.0 - 1.0).
blf.shadow_offset(fontid, x, y)
Set the offset for shadow text.
Parameters
fontid (int) – The id of the typeface as returned by blf.load(), for default font use 0.
x (float) – Vertical shadow offset value in pixels.
y (float) – Horizontal shadow offset value in pixels.
blf.size(fontid, size, dpi=72)
Set the size for drawing text.
Parameters
fontid (int) – The id of the typeface as returned by blf.load(), for default font use 0.
size (float) – Point size of the font.
dpi (int) – DEPRECATED: Defaults to 72 when omitted.
blf.unload(filepath)
Unload an existing font.
Parameters
filepath (string) – the filepath of the font.
blf.word_wrap(fontid, wrap_width)
Set the wrap width, enable/disable using WORD_WRAP.
Parameters
fontid (int) – The id of the typeface as returned by blf.load(), for default font use 0.
wrap_width (int) – The width (in pixels) to wrap words at.
blf.CLIPPING
Constant value 2
blf.MONOCHROME
Constant value 128
blf.ROTATION
Constant value 1
blf.SHADOW
Constant value 4
blf.WORD_WRAP
Constant value 64
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment