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
60e3b01a
Commit
60e3b01a
authored
Dec 16, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed drawing of rotated texts that are not horizontally center aligned.
parent
bb8741c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
42 deletions
+1
-42
stroke_font.cpp
common/gal/stroke_font.cpp
+1
-2
class_pcb_text.cpp
pcbnew/class_pcb_text.cpp
+0
-37
class_pcb_text.h
pcbnew/class_pcb_text.h
+0
-3
No files found.
common/gal/stroke_font.cpp
View file @
60e3b01a
...
...
@@ -153,6 +153,7 @@ void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double
m_gal
->
Save
();
m_gal
->
Translate
(
aPosition
);
m_gal
->
Rotate
(
-
aRotationAngle
);
// Single line height
int
lineHeight
=
getInterline
();
...
...
@@ -177,8 +178,6 @@ void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double
break
;
}
m_gal
->
Rotate
(
-
aRotationAngle
);
m_gal
->
SetIsStroke
(
true
);
m_gal
->
SetIsFill
(
false
);
...
...
pcbnew/class_pcb_text.cpp
View file @
60e3b01a
...
...
@@ -205,40 +205,3 @@ EDA_ITEM* TEXTE_PCB::Clone() const
{
return
new
TEXTE_PCB
(
*
this
);
}
const
BOX2I
TEXTE_PCB
::
ViewBBox
()
const
{
EDA_RECT
rect
=
GetTextBox
();
if
(
m_Orient
!=
0.0
)
{
// If the text is rotated, we need to take it into account
wxPoint
p1
=
rect
.
GetOrigin
();
wxPoint
p2
=
wxPoint
(
p1
.
x
+
rect
.
GetWidth
(),
p1
.
y
);
wxPoint
p3
=
rect
.
GetEnd
();
wxPoint
p4
=
wxPoint
(
p1
.
x
,
p1
.
y
+
rect
.
GetHeight
()
);
// Transform all the corners of the bounding box according to the rotation angle
RotatePoint
(
&
p1
,
m_Pos
,
-
m_Orient
);
RotatePoint
(
&
p2
,
m_Pos
,
-
m_Orient
);
RotatePoint
(
&
p3
,
m_Pos
,
-
m_Orient
);
RotatePoint
(
&
p4
,
m_Pos
,
-
m_Orient
);
// Find the new bounding box origin and dimensions
int
minX
=
std
::
min
(
std
::
min
(
p1
.
x
,
p2
.
x
),
std
::
min
(
p3
.
x
,
p4
.
x
)
);
int
minY
=
std
::
min
(
std
::
min
(
p1
.
y
,
p2
.
y
),
std
::
min
(
p3
.
y
,
p4
.
y
)
);
int
maxX
=
std
::
max
(
std
::
max
(
p1
.
x
,
p2
.
x
),
std
::
max
(
p3
.
x
,
p4
.
x
)
);
int
maxY
=
std
::
max
(
std
::
max
(
p1
.
y
,
p2
.
y
),
std
::
max
(
p3
.
y
,
p4
.
y
)
);
int
width
=
maxX
-
minX
;
int
height
=
maxY
-
minY
;
return
BOX2I
(
VECTOR2I
(
minX
,
minY
),
VECTOR2I
(
width
,
height
)
);
}
else
{
return
BOX2I
(
rect
.
GetOrigin
(),
rect
.
GetSize
()
);
}
}
pcbnew/class_pcb_text.h
View file @
60e3b01a
...
...
@@ -135,9 +135,6 @@ public:
EDA_ITEM
*
Clone
()
const
;
/// @copydoc VIEW_ITEM::ViewBBox()
virtual
const
BOX2I
ViewBBox
()
const
;
#if defined(DEBUG)
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
ShowDummy
(
os
);
}
// override
#endif
...
...
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