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
93c2f87d
Commit
93c2f87d
authored
Aug 09, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't include spacing in symbol font text drawing alignment&size calculations
parent
56dcf766
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
src/data/symbol_font.cpp
src/data/symbol_font.cpp
+5
-1
src/data/symbol_font.hpp
src/data/symbol_font.hpp
+2
-2
No files found.
src/data/symbol_font.cpp
View file @
93c2f87d
...
@@ -283,10 +283,14 @@ void SymbolFont::drawSymbol(RotatedDC& dc, RealRect sym_rect, double font_size,
...
@@ -283,10 +283,14 @@ void SymbolFont::drawSymbol(RotatedDC& dc, RealRect sym_rect, double font_size,
// find bitmap
// find bitmap
Bitmap
bmp
=
sym
.
getBitmap
(
*
this
,
dc
.
trS
(
font_size
));
Bitmap
bmp
=
sym
.
getBitmap
(
*
this
,
dc
.
trS
(
font_size
));
// draw aligned in the rectangle
// draw aligned in the rectangle
dc
.
DrawBitmap
(
bmp
,
align_in_rect
(
align
,
dc
.
trInvS
(
RealSize
(
bmp
.
GetWidth
(),
bmp
.
GetHeight
())),
sym_rect
));
RealSize
bmp_size
=
dc
.
trInvS
(
RealSize
(
bmp
));
RealPoint
bmp_pos
=
align_in_rect
(
align
,
bmp_size
,
sym_rect
);
dc
.
DrawBitmap
(
bmp
,
bmp_pos
);
// 2. draw text
// 2. draw text
if
(
text
.
empty
()
||
!
sym
.
text_font
)
return
;
if
(
text
.
empty
()
||
!
sym
.
text_font
)
return
;
// only use the bitmap rectangle
sym_rect
=
RealRect
(
bmp_pos
,
bmp_size
);
// subtract margins from size
// subtract margins from size
sym_rect
.
x
+=
font_size
*
sym
.
text_margin_left
;
sym_rect
.
x
+=
font_size
*
sym
.
text_margin_left
;
sym_rect
.
y
+=
font_size
*
sym
.
text_margin_top
;
sym_rect
.
y
+=
font_size
*
sym
.
text_margin_top
;
...
...
src/data/symbol_font.hpp
View file @
93c2f87d
...
@@ -101,10 +101,10 @@ class SymbolFont : public Packaged {
...
@@ -101,10 +101,10 @@ class SymbolFont : public Packaged {
/// Draws a single symbol inside the given rectangle
/// Draws a single symbol inside the given rectangle
void
drawSymbol
(
RotatedDC
&
dc
,
RealRect
sym_rect
,
double
font_size
,
const
Alignment
&
align
,
SymbolInFont
&
sym
,
const
String
&
text
);
void
drawSymbol
(
RotatedDC
&
dc
,
RealRect
sym_rect
,
double
font_size
,
const
Alignment
&
align
,
SymbolInFont
&
sym
,
const
String
&
text
);
/// Size of a single symbol
/// Size of a single symbol
, including spacing
RealSize
symbolSize
(
double
font_size
,
const
DrawableSymbol
&
sym
);
RealSize
symbolSize
(
double
font_size
,
const
DrawableSymbol
&
sym
);
public:
public:
/// The default size of symbols
/// The default size of symbols
, including spacing
RealSize
defaultSymbolSize
(
double
font_size
);
RealSize
defaultSymbolSize
(
double
font_size
);
DECLARE_REFLECTION
();
DECLARE_REFLECTION
();
...
...
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