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
0304598a
Commit
0304598a
authored
Jul 07, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed vertical alignment for strings that contain a newline character at the end (GAL).
parent
fb0045a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
stroke_font.cpp
common/gal/stroke_font.cpp
+5
-1
stroke_font.h
include/gal/stroke_font.h
+7
-11
No files found.
common/gal/stroke_font.cpp
View file @
0304598a
...
@@ -40,7 +40,8 @@ STROKE_FONT::STROKE_FONT( GAL* aGal ) :
...
@@ -40,7 +40,8 @@ STROKE_FONT::STROKE_FONT( GAL* aGal ) :
m_gal
(
aGal
),
m_gal
(
aGal
),
m_bold
(
false
),
m_bold
(
false
),
m_italic
(
false
),
m_italic
(
false
),
m_mirrored
(
false
)
m_mirrored
(
false
),
m_overbar
(
false
)
{
{
// Default values
// Default values
m_glyphSize
=
VECTOR2D
(
10.0
,
10.0
);
m_glyphSize
=
VECTOR2D
(
10.0
,
10.0
);
...
@@ -149,6 +150,9 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY
...
@@ -149,6 +150,9 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY
void
STROKE_FONT
::
Draw
(
const
UTF8
&
aText
,
const
VECTOR2D
&
aPosition
,
double
aRotationAngle
)
void
STROKE_FONT
::
Draw
(
const
UTF8
&
aText
,
const
VECTOR2D
&
aPosition
,
double
aRotationAngle
)
{
{
if
(
aText
.
empty
()
)
return
;
// Context needs to be saved before any transformations
// Context needs to be saved before any transformations
m_gal
->
Save
();
m_gal
->
Save
();
...
...
include/gal/stroke_font.h
View file @
0304598a
...
@@ -189,17 +189,13 @@ private:
...
@@ -189,17 +189,13 @@ private:
* @param aText is the text to be checked.
* @param aText is the text to be checked.
* @return unsigned - The number of lines in aText.
* @return unsigned - The number of lines in aText.
*/
*/
unsigned
linesCount
(
const
UTF8
&
aText
)
const
inline
unsigned
linesCount
(
const
UTF8
&
aText
)
const
{
{
unsigned
lines
=
1
;
if
(
aText
.
empty
()
)
return
0
;
// std::count does not work well with empty strings
for
(
UTF8
::
const_iterator
it
=
aText
.
begin
(),
itEnd
=
aText
.
end
();
it
!=
itEnd
;
++
it
)
else
{
// aText.end() - 1 is to skip a newline character that is potentially at the end
if
(
*
it
==
'\n'
)
return
std
::
count
(
aText
.
begin
(),
aText
.
end
()
-
1
,
'\n'
)
+
1
;
++
lines
;
}
return
lines
;
}
}
///> Factor that determines relative height of overbar.
///> Factor that determines relative height of overbar.
...
@@ -208,7 +204,7 @@ private:
...
@@ -208,7 +204,7 @@ private:
///> Factor that determines relative line width for bold text.
///> Factor that determines relative line width for bold text.
static
const
double
BOLD_FACTOR
;
static
const
double
BOLD_FACTOR
;
///> Scale factor for
the
glyph
///> Scale factor for
a
glyph
static
const
double
HERSHEY_SCALE
;
static
const
double
HERSHEY_SCALE
;
};
};
}
// namespace KIGFX
}
// namespace KIGFX
...
...
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