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
58280f74
Commit
58280f74
authored
Jul 09, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed multiline vertical strings drawing bug.
parent
6c3534bd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
13 deletions
+20
-13
stroke_font.cpp
common/gal/stroke_font.cpp
+12
-13
stroke_font.h
include/gal/stroke_font.h
+2
-0
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+6
-0
No files found.
common/gal/stroke_font.cpp
View file @
58280f74
...
...
@@ -140,30 +140,29 @@ BOX2D STROKE_FONT::computeBoundingBox( const Glyph& aGlyph, const VECTOR2D& aGly
void
STROKE_FONT
::
Draw
(
std
::
string
aText
,
const
VECTOR2D
&
aPosition
,
double
aRotationAngle
)
{
// Split multiline strings into separate ones and draw line by line
// By default overbar is turned off
m_overbar
=
false
;
// Context needs to be saved before any transformations
m_gal
->
Save
();
m_gal
->
Translate
(
aPosition
);
m_gal
->
Rotate
(
-
aRotationAngle
);
// Split multiline strings into separate ones and draw them line by line
size_t
newlinePos
=
aText
.
find
(
'\n'
);
if
(
newlinePos
!=
std
::
string
::
npos
)
{
VECTOR2D
nextlinePosition
(
aPosition
);
nextlinePosition
+=
VECTOR2D
(
0.0
,
m_glyphSize
.
y
*
1.6
);
// FIXME remove magic number
VECTOR2D
nextlinePosition
=
VECTOR2D
(
0.0
,
m_glyphSize
.
y
*
LINE_HEIGHT_RATIO
);
Draw
(
aText
.
substr
(
newlinePos
+
1
),
nextlinePosition
,
aRotationAngle
);
Draw
(
aText
.
substr
(
newlinePos
+
1
),
nextlinePosition
,
0.0
);
aText
=
aText
.
substr
(
0
,
newlinePos
);
}
// Compute the text size
VECTOR2D
textsize
=
computeTextSize
(
aText
);
// By default overbar is turned off
m_overbar
=
false
;
// Context needs to be saved before any transformations
m_gal
->
Save
();
m_gal
->
Translate
(
aPosition
);
m_gal
->
Rotate
(
-
aRotationAngle
);
// Adjust the text position to the given alignment
switch
(
m_horizontalJustify
)
{
...
...
include/gal/stroke_font.h
View file @
58280f74
...
...
@@ -181,6 +181,8 @@ private:
* @return is the text size.
*/
VECTOR2D
computeTextSize
(
const
std
::
string
&
aText
)
const
;
static
const
double
LINE_HEIGHT_RATIO
=
1
.
6
;
};
}
// namespace KiGfx
...
...
pcbnew/pcb_painter.cpp
View file @
58280f74
...
...
@@ -599,6 +599,9 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment )
void
PCB_PAINTER
::
draw
(
const
TEXTE_PCB
*
aText
)
{
if
(
aText
->
GetText
().
Length
()
==
0
)
return
;
COLOR4D
strokeColor
=
getLayerColor
(
aText
->
GetLayer
(),
0
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
double
orientation
=
aText
->
GetOrientation
()
*
M_PI
/
1800.0
;
...
...
@@ -612,6 +615,9 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText )
void
PCB_PAINTER
::
draw
(
const
TEXTE_MODULE
*
aText
,
int
aLayer
)
{
if
(
aText
->
GetLength
()
==
0
)
return
;
COLOR4D
strokeColor
=
getLayerColor
(
aLayer
,
0
);
VECTOR2D
position
(
aText
->
GetTextPosition
().
x
,
aText
->
GetTextPosition
().
y
);
double
orientation
=
aText
->
GetDrawRotation
()
*
M_PI
/
1800.0
;
...
...
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