Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
ed535ee2
Commit
ed535ee2
authored
Aug 08, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made symbol font size and alignment scriptable.
parent
67e0732b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
15 deletions
+20
-15
doc/type/symbol_font_reference.txt
doc/type/symbol_font_reference.txt
+5
-5
src/data/symbol_font.cpp
src/data/symbol_font.cpp
+9
-4
src/data/symbol_font.hpp
src/data/symbol_font.hpp
+5
-5
src/render/text/symbol.cpp
src/render/text/symbol.cpp
+1
-1
No files found.
doc/type/symbol_font_reference.txt
View file @
ed535ee2
...
...
@@ -7,12 +7,12 @@ A reference to a [[type:symbol font]].
In [[type:stylesheet]]s the symbol fonts are not included inline, instead they are referenced by their package name.
--Properties--
! Property Type Default Description
! Property Type
Default Description
| @name@ [[type:scriptable]] Name of a [[type:symbol font]]
''required'' Name of the symbol font package to use (without the extension).
| @size@ [[type:
double]]
12 Size in points to render the symbols with.
| @scale down to@ [[type:double]] 1 Minimum size in points to scale the size down to.
| @alignment@ [[type:alignment]] @"middle center"@ Alignment of symbols in a line of text.
''required'' Name of the symbol font package to use (without the extension).
| @size@ [[type:
scriptable]] [[type:double]]
12 Size in points to render the symbols with.
| @scale down to@ [[type:double]]
1 Minimum size in points to scale the size down to.
| @alignment@ [[type:
scriptable]] [[type:
alignment]] @"middle center"@ Alignment of symbols in a line of text.
--Example--
>symbol font:
...
...
src/data/symbol_font.cpp
View file @
ed535ee2
...
...
@@ -550,17 +550,22 @@ bool SymbolFontRef::valid() const {
}
bool
SymbolFontRef
::
update
(
Context
&
ctx
)
{
bool
changes
=
false
;
if
(
name
.
update
(
ctx
))
{
// font name changed, load another font
loadFont
(
ctx
);
return
true
;
}
else
{
if
(
!
font
)
loadFont
(
ctx
);
return
false
;
changes
=
true
;
}
else
if
(
!
font
)
{
loadFont
(
ctx
);
}
changes
|=
size
.
update
(
ctx
);
changes
|=
alignment
.
update
(
ctx
);
return
changes
;
}
void
SymbolFontRef
::
initDependencies
(
Context
&
ctx
,
const
Dependency
&
dep
)
const
{
name
.
initDependencies
(
ctx
,
dep
);
size
.
initDependencies
(
ctx
,
dep
);
alignment
.
initDependencies
(
ctx
,
dep
);
}
void
SymbolFontRef
::
loadFont
(
Context
&
ctx
)
{
...
...
src/data/symbol_font.hpp
View file @
ed535ee2
...
...
@@ -154,11 +154,11 @@ class SymbolFontRef {
/// Is a font loaded?
bool
valid
()
const
;
Scriptable
<
String
>
name
;
///< Font package name, can be changed with script
double
size
;
///< Size of the font
double
scale_down_to
;
///< Mimumum size of the font
Alignment
alignment
;
///< Alignment of symbols in a line of text
SymbolFontP
font
;
///< The font, if it is loaded
Scriptable
<
String
>
name
;
///< Font package name, can be changed with script
Scriptable
<
double
>
size
;
///< Size of the font
double
scale_down_to
;
///< Mimumum size of the font
Scriptable
<
Alignment
>
alignment
;
///< Alignment of symbols in a line of text
SymbolFontP
font
;
///< The font, if it is loaded
private:
DECLARE_REFLECTION
();
...
...
src/render/text/symbol.cpp
View file @
ed535ee2
...
...
@@ -26,7 +26,7 @@ void SymbolTextElement::getCharInfo(RotatedDC& dc, double scale, vector<CharInfo
}
double
SymbolTextElement
::
minScale
()
const
{
return
min
(
font
.
size
,
font
.
scale_down_to
)
/
max
(
0.01
,
font
.
size
);
return
min
(
font
.
size
(),
font
.
scale_down_to
)
/
max
(
0.01
,
font
.
size
()
);
}
double
SymbolTextElement
::
scaleStep
()
const
{
return
1.
/
max
(
font
.
size
*
4
,
1.
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment