Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
7721d02a
Commit
7721d02a
authored
Nov 14, 2014
by
Tomasz Wlostowski
Committed by
Maciej Suminski
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gal/stroke_font: made text vertical alignment follow the non-GAL renderer.
parent
33f3aca6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
11 deletions
+28
-11
stroke_font.cpp
common/gal/stroke_font.cpp
+28
-11
No files found.
common/gal/stroke_font.cpp
View file @
7721d02a
...
...
@@ -98,7 +98,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
// Every coordinate description of the Hershey format has an offset,
// it has to be subtracted
point
.
x
=
(
double
)
(
coordinate
[
0
]
-
'R'
)
*
HERSHEY_SCALE
-
glyphStartX
;
point
.
y
=
(
double
)
(
coordinate
[
1
]
-
'R'
)
*
HERSHEY_SCALE
;
// -10 is here to keep GAL rendering consistent with the legacy gfx stuff
point
.
y
=
(
double
)
(
coordinate
[
1
]
-
'R'
-
10
)
*
HERSHEY_SCALE
;
pointList
.
push_back
(
point
);
}
...
...
@@ -160,28 +161,44 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo
m_gal
->
Rotate
(
-
aRotationAngle
);
// Single line height
int
lineHeight
=
getInterline
();
// The overall height of all lines of text
double
textBlockHeight
=
lineHeight
*
(
linesCount
(
aText
)
-
1
);
int
lineHeight
=
getInterline
(
);
int
lineCount
=
linesCount
(
aText
);
// align the 1st line of text
switch
(
m_verticalJustify
)
{
case
GR_TEXT_VJUSTIFY_
CENTER
:
m_gal
->
Translate
(
VECTOR2D
(
0
,
-
textBlockHeight
/
2.0
)
);
case
GR_TEXT_VJUSTIFY_
TOP
:
m_gal
->
Translate
(
VECTOR2D
(
0
,
m_glyphSize
.
y
)
);
break
;
case
GR_TEXT_VJUSTIFY_
BOTTOM
:
m_gal
->
Translate
(
VECTOR2D
(
0
,
-
textBlockHeight
)
);
case
GR_TEXT_VJUSTIFY_
CENTER
:
m_gal
->
Translate
(
VECTOR2D
(
0
,
m_glyphSize
.
y
/
2.0
)
);
break
;
case
GR_TEXT_VJUSTIFY_
TOP
:
case
GR_TEXT_VJUSTIFY_
BOTTOM
:
break
;
default
:
break
;
}
if
(
lineCount
>
1
)
{
switch
(
m_verticalJustify
)
{
case
GR_TEXT_VJUSTIFY_TOP
:
break
;
case
GR_TEXT_VJUSTIFY_CENTER
:
m_gal
->
Translate
(
VECTOR2D
(
0
,
-
(
lineCount
-
1
)
*
lineHeight
/
2
)
);
break
;
case
GR_TEXT_VJUSTIFY_BOTTOM
:
m_gal
->
Translate
(
VECTOR2D
(
0
,
-
(
lineCount
-
1
)
*
lineHeight
)
);
break
;
}
}
m_gal
->
SetIsStroke
(
true
);
m_gal
->
SetIsFill
(
false
);
...
...
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