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
e9f41a3b
Commit
e9f41a3b
authored
Nov 03, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Opengl display: fix incorrect text size of pad num and pad netname.
parent
1e9cbe80
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
27 deletions
+42
-27
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+42
-27
No files found.
pcbnew/pcb_painter.cpp
View file @
e9f41a3b
...
...
@@ -378,6 +378,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
double
orientation
=
aPad
->
GetOrientation
();
NORMALIZE_ANGLE_90
(
orientation
);
// do not display descriptions upside down
orientation
=
orientation
*
M_PI
/
1800.0
;
wxString
buffer
;
// Draw description layer
if
(
IsNetnameLayer
(
aLayer
)
)
...
...
@@ -387,32 +388,31 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
{
bool
displayNetname
=
(
m_pcbSettings
->
m_netNamesOnPads
&&
!
aPad
->
GetNetname
().
empty
()
);
size
=
VECTOR2D
(
aPad
->
GetSize
()
/
2
);
VECTOR2D
padsize
=
VECTOR2D
(
aPad
->
GetSize
()
);
size
=
padsize
;
double
scale
=
m_gal
->
GetZoomFactor
();
double
maxSize
=
PCB_RENDER_SETTINGS
::
MAX_FONT_SIZE
/
scale
;
// Font size limits
if
(
size
.
x
>
maxSize
)
size
.
x
=
maxSize
;
if
(
size
.
y
>
maxSize
)
size
.
y
=
maxSize
;
double
maxSize
=
PCB_RENDER_SETTINGS
::
MAX_FONT_SIZE
;
// Keep the size ratio for the font, but make it smaller
if
(
size
.
x
<
size
.
y
)
if
(
padsize
.
x
<
pad
size
.
y
)
{
orientation
-=
M_PI
/
2.0
;
size
.
y
=
size
.
x
*
4.0
/
3.0
;
size
.
y
=
size
.
x
;
}
else
if
(
size
.
x
==
size
.
y
)
else
if
(
padsize
.
x
==
pad
size
.
y
)
{
// If the text is displayed on a symmetrical pad, do not rotate it
orientation
=
0.0
;
}
else
{
size
.
x
=
size
.
y
*
3.0
/
4.0
;
size
.
x
=
size
.
y
;
}
// Font size limits
if
(
size
.
x
>
maxSize
)
size
.
x
=
size
.
y
=
maxSize
;
m_gal
->
Save
();
m_gal
->
Translate
(
position
);
m_gal
->
Rotate
(
-
orientation
);
...
...
@@ -433,36 +433,51 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
else
m_gal
->
SetStrokeColor
(
labelColor
);
VECTOR2D
textpos
(
0.0
,
0.0
);
if
(
displayNetname
&&
m_pcbSettings
->
m_padNumbers
)
{
m_gal
->
SetHorizontalJustify
(
GR_TEXT_HJUSTIFY_CENTER
);
m_gal
->
SetVerticalJustify
(
GR_TEXT_VJUSTIFY_CENTER
);
// Divide the space, when both pad numbers and netnames are enabled
size
=
size
/
2.0
;
m_gal
->
SetGlyphSize
(
size
);
m_gal
->
SetLineWidth
(
size
.
y
/
8.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetNetname
().
mb_str
()
),
VECTOR2D
(
0.0
,
size
.
y
),
0.0
);
aPad
->
ReturnStringPadName
(
buffer
);
VECTOR2D
numsize
=
size
/
buffer
.
Length
();
VECTOR2D
namesize
=
size
/
aPad
->
GetShortNetname
().
Length
();
textpos
.
y
=
size
.
y
/
2.0
;
m_gal
->
SetGlyphSize
(
namesize
);
m_gal
->
SetLineWidth
(
namesize
.
y
/
8.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetShortNetname
().
mb_str
()
),
textpos
,
0.0
);
textpos
.
y
=
-
size
.
y
/
2.0
;
m_gal
->
SetGlyphSize
(
numsize
);
m_gal
->
SetLineWidth
(
numsize
.
y
/
8.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetPadName
().
mb_str
()
),
VECTOR2D
(
0.0
,
-
size
.
y
/
2.0
)
,
0.0
);
textpos
,
0.0
);
}
else
{
// There is only one thing to display
if
(
displayNetname
)
{
m_gal
->
SetGlyphSize
(
size
/
2.0
);
m_gal
->
SetLineWidth
(
size
.
y
/
12.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetNetname
().
mb_str
()
),
VECTOR2D
(
0.0
,
0.0
),
0.0
);
VECTOR2D
namesize
=
size
/
aPad
->
GetShortNetname
().
Length
();
m_gal
->
SetGlyphSize
(
namesize
/
2.0
);
m_gal
->
SetLineWidth
(
namesize
.
y
/
8.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetShortNetname
().
mb_str
()
),
textpos
,
0.0
);
}
if
(
m_pcbSettings
->
m_padNumbers
)
{
m_gal
->
SetGlyphSize
(
size
);
m_gal
->
SetLineWidth
(
size
.
y
/
10.0
);
aPad
->
ReturnStringPadName
(
buffer
);
VECTOR2D
numsize
=
size
/
2
/
buffer
.
Length
();
m_gal
->
SetGlyphSize
(
numsize
);
m_gal
->
SetLineWidth
(
numsize
.
y
/
8.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetPadName
().
mb_str
()
),
VECTOR2D
(
0.0
,
0.0
)
,
0.0
);
textpos
,
0.0
);
}
}
...
...
@@ -860,4 +875,4 @@ void PCB_PAINTER::draw( const PCB_TARGET* aTarget )
}
const
double
PCB_RENDER_SETTINGS
::
MAX_FONT_SIZE
=
100000000
;
const
double
PCB_RENDER_SETTINGS
::
MAX_FONT_SIZE
=
Millimeter2iu
(
10.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