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
7678983e
Commit
7678983e
authored
Dec 03, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed non ASCII characters drawing using GAL.
parent
c6d7ee7e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
18 deletions
+17
-18
stroke_font.cpp
common/gal/stroke_font.cpp
+7
-7
worksheet_viewitem.cpp
common/worksheet_viewitem.cpp
+1
-1
graphics_abstraction_layer.h
include/gal/graphics_abstraction_layer.h
+1
-1
stroke_font.h
include/gal/stroke_font.h
+2
-2
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+6
-7
No files found.
common/gal/stroke_font.cpp
View file @
7678983e
...
@@ -142,7 +142,7 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY
...
@@ -142,7 +142,7 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY
}
}
void
STROKE_FONT
::
Draw
(
std
::
string
aText
,
const
VECTOR2D
&
aPosition
,
double
aRotationAngle
)
void
STROKE_FONT
::
Draw
(
std
::
w
string
aText
,
const
VECTOR2D
&
aPosition
,
double
aRotationAngle
)
{
{
// By default overbar is turned off
// By default overbar is turned off
m_overbar
=
false
;
m_overbar
=
false
;
...
@@ -156,7 +156,7 @@ void STROKE_FONT::Draw( std::string aText, const VECTOR2D& aPosition, double aRo
...
@@ -156,7 +156,7 @@ void STROKE_FONT::Draw( std::string aText, const VECTOR2D& aPosition, double aRo
// Split multiline strings into separate ones and draw them line by line
// Split multiline strings into separate ones and draw them line by line
size_t
newlinePos
=
aText
.
find
(
'\n'
);
size_t
newlinePos
=
aText
.
find
(
'\n'
);
if
(
newlinePos
!=
std
::
string
::
npos
)
if
(
newlinePos
!=
std
::
w
string
::
npos
)
{
{
VECTOR2D
nextlinePosition
=
VECTOR2D
(
0.0
,
m_glyphSize
.
y
*
LINE_HEIGHT_RATIO
);
VECTOR2D
nextlinePosition
=
VECTOR2D
(
0.0
,
m_glyphSize
.
y
*
LINE_HEIGHT_RATIO
);
...
@@ -233,7 +233,7 @@ void STROKE_FONT::Draw( std::string aText, const VECTOR2D& aPosition, double aRo
...
@@ -233,7 +233,7 @@ void STROKE_FONT::Draw( std::string aText, const VECTOR2D& aPosition, double aRo
m_gal
->
SetLineWidth
(
m_gal
->
GetLineWidth
()
*
1.3
);
m_gal
->
SetLineWidth
(
m_gal
->
GetLineWidth
()
*
1.3
);
}
}
for
(
std
::
string
::
const_iterator
chIt
=
aText
.
begin
();
chIt
!=
aText
.
end
();
chIt
++
)
for
(
std
::
w
string
::
const_iterator
chIt
=
aText
.
begin
();
chIt
!=
aText
.
end
();
chIt
++
)
{
{
if
(
*
chIt
==
'~'
)
if
(
*
chIt
==
'~'
)
{
{
...
@@ -244,7 +244,7 @@ void STROKE_FONT::Draw( std::string aText, const VECTOR2D& aPosition, double aRo
...
@@ -244,7 +244,7 @@ void STROKE_FONT::Draw( std::string aText, const VECTOR2D& aPosition, double aRo
GLYPH_LIST
::
iterator
glyphIt
=
m_glyphs
.
begin
();
GLYPH_LIST
::
iterator
glyphIt
=
m_glyphs
.
begin
();
std
::
deque
<
BOX2D
>::
iterator
bbIt
=
m_glyphBoundingBoxes
.
begin
();
std
::
deque
<
BOX2D
>::
iterator
bbIt
=
m_glyphBoundingBoxes
.
begin
();
unsigned
dd
=
(
unsigned
)
((
unsigned
char
)
*
chIt
)
-
(
unsigned
)
' '
;
unsigned
dd
=
*
chIt
-
' '
;
if
(
dd
>=
m_glyphBoundingBoxes
.
size
()
)
if
(
dd
>=
m_glyphBoundingBoxes
.
size
()
)
dd
=
'?'
-
' '
;
dd
=
'?'
-
' '
;
...
@@ -292,17 +292,17 @@ void STROKE_FONT::Draw( std::string aText, const VECTOR2D& aPosition, double aRo
...
@@ -292,17 +292,17 @@ void STROKE_FONT::Draw( std::string aText, const VECTOR2D& aPosition, double aRo
}
}
VECTOR2D
STROKE_FONT
::
computeTextSize
(
const
std
::
string
&
aText
)
const
VECTOR2D
STROKE_FONT
::
computeTextSize
(
const
std
::
w
string
&
aText
)
const
{
{
VECTOR2D
result
=
VECTOR2D
(
0.0
,
m_glyphSize
.
y
);
VECTOR2D
result
=
VECTOR2D
(
0.0
,
m_glyphSize
.
y
);
for
(
std
::
string
::
const_iterator
chIt
=
aText
.
begin
();
chIt
!=
aText
.
end
();
chIt
++
)
for
(
std
::
w
string
::
const_iterator
chIt
=
aText
.
begin
();
chIt
!=
aText
.
end
();
chIt
++
)
{
{
if
(
*
chIt
==
'~'
)
if
(
*
chIt
==
'~'
)
continue
;
continue
;
std
::
deque
<
BOX2D
>::
const_iterator
bbIt
=
m_glyphBoundingBoxes
.
begin
();
std
::
deque
<
BOX2D
>::
const_iterator
bbIt
=
m_glyphBoundingBoxes
.
begin
();
unsigned
dd
=
(
unsigned
)
((
unsigned
char
)
*
chIt
)
-
(
unsigned
)
' '
;
unsigned
dd
=
*
chIt
-
' '
;
if
(
dd
>=
m_glyphBoundingBoxes
.
size
()
)
if
(
dd
>=
m_glyphBoundingBoxes
.
size
()
)
dd
=
'?'
-
' '
;
dd
=
'?'
-
' '
;
...
...
common/worksheet_viewitem.cpp
View file @
7678983e
...
@@ -191,7 +191,7 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_TEXT* aItem, GAL* aGal ) const
...
@@ -191,7 +191,7 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_TEXT* aItem, GAL* aGal ) const
aGal
->
SetStrokeColor
(
COLOR4D
(
aItem
->
GetColor
()
)
);
aGal
->
SetStrokeColor
(
COLOR4D
(
aItem
->
GetColor
()
)
);
aGal
->
SetLineWidth
(
aItem
->
GetThickness
()
);
aGal
->
SetLineWidth
(
aItem
->
GetThickness
()
);
aGal
->
SetTextAttributes
(
aItem
);
aGal
->
SetTextAttributes
(
aItem
);
aGal
->
StrokeText
(
std
::
string
(
aItem
->
GetText
().
mb
_str
()
),
position
,
0.0
);
aGal
->
StrokeText
(
std
::
wstring
(
aItem
->
GetText
().
wc
_str
()
),
position
,
0.0
);
}
}
...
...
include/gal/graphics_abstraction_layer.h
View file @
7678983e
...
@@ -277,7 +277,7 @@ public:
...
@@ -277,7 +277,7 @@ public:
* @param aPosition is the text position in world coordinates.
* @param aPosition is the text position in world coordinates.
* @param aRotationAngle is the text rotation angle.
* @param aRotationAngle is the text rotation angle.
*/
*/
inline
virtual
void
StrokeText
(
const
std
::
string
&
aText
,
const
VECTOR2D
&
aPosition
,
inline
virtual
void
StrokeText
(
const
std
::
w
string
&
aText
,
const
VECTOR2D
&
aPosition
,
double
aRotationAngle
)
double
aRotationAngle
)
{
{
strokeFont
.
Draw
(
aText
,
aPosition
,
aRotationAngle
);
strokeFont
.
Draw
(
aText
,
aPosition
,
aRotationAngle
);
...
...
include/gal/stroke_font.h
View file @
7678983e
...
@@ -73,7 +73,7 @@ public:
...
@@ -73,7 +73,7 @@ public:
* @param aPosition is the text position in world coordinates.
* @param aPosition is the text position in world coordinates.
* @param aRotationAngle is the text rotation angle.
* @param aRotationAngle is the text rotation angle.
*/
*/
void
Draw
(
std
::
string
aText
,
const
VECTOR2D
&
aPosition
,
double
aRotationAngle
);
void
Draw
(
std
::
w
string
aText
,
const
VECTOR2D
&
aPosition
,
double
aRotationAngle
);
/**
/**
* @brief Set the scale factor of the font for the glyph size.
* @brief Set the scale factor of the font for the glyph size.
...
@@ -180,7 +180,7 @@ private:
...
@@ -180,7 +180,7 @@ private:
* @param aText is the text string.
* @param aText is the text string.
* @return is the text size.
* @return is the text size.
*/
*/
VECTOR2D
computeTextSize
(
const
std
::
string
&
aText
)
const
;
VECTOR2D
computeTextSize
(
const
std
::
w
string
&
aText
)
const
;
static
const
double
LINE_HEIGHT_RATIO
;
static
const
double
LINE_HEIGHT_RATIO
;
};
};
...
...
pcbnew/pcb_painter.cpp
View file @
7678983e
...
@@ -280,7 +280,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
...
@@ -280,7 +280,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
if
(
!
net
)
if
(
!
net
)
return
;
return
;
std
::
string
netName
=
std
::
string
(
net
->
GetShortNetname
().
mb
_str
()
);
std
::
wstring
netName
=
std
::
wstring
(
net
->
GetShortNetname
().
wc
_str
()
);
VECTOR2D
textPosition
=
start
+
line
/
2.0
;
// center of the track
VECTOR2D
textPosition
=
start
+
line
/
2.0
;
// center of the track
double
textOrientation
=
-
atan
(
line
.
y
/
line
.
x
);
double
textOrientation
=
-
atan
(
line
.
y
/
line
.
x
);
double
textSize
=
std
::
min
(
static_cast
<
double
>
(
width
),
length
/
netName
.
length
()
);
double
textSize
=
std
::
min
(
static_cast
<
double
>
(
width
),
length
/
netName
.
length
()
);
...
@@ -456,7 +456,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
...
@@ -456,7 +456,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
VECTOR2D
namesize
(
tsize
,
tsize
);
VECTOR2D
namesize
(
tsize
,
tsize
);
m_gal
->
SetGlyphSize
(
namesize
);
m_gal
->
SetGlyphSize
(
namesize
);
m_gal
->
SetLineWidth
(
namesize
.
x
/
12.0
);
m_gal
->
SetLineWidth
(
namesize
.
x
/
12.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetShortNetname
().
mb
_str
()
),
m_gal
->
StrokeText
(
std
::
wstring
(
aPad
->
GetShortNetname
().
wc
_str
()
),
textpos
,
0.0
);
textpos
,
0.0
);
}
}
...
@@ -474,8 +474,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
...
@@ -474,8 +474,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m_gal
->
SetGlyphSize
(
numsize
);
m_gal
->
SetGlyphSize
(
numsize
);
m_gal
->
SetLineWidth
(
numsize
.
x
/
12.0
);
m_gal
->
SetLineWidth
(
numsize
.
x
/
12.0
);
m_gal
->
StrokeText
(
std
::
string
(
aPad
->
GetPadName
().
mb_str
()
),
m_gal
->
StrokeText
(
std
::
wstring
(
aPad
->
GetPadName
().
wc_str
()
),
textpos
,
0.0
);
textpos
,
0.0
);
}
}
m_gal
->
Restore
();
m_gal
->
Restore
();
...
@@ -720,7 +719,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
...
@@ -720,7 +719,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb
_str
()
),
position
,
orientation
);
m_gal
->
StrokeText
(
std
::
wstring
(
aText
->
GetText
().
wc
_str
()
),
position
,
orientation
);
}
}
...
@@ -736,7 +735,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
...
@@ -736,7 +735,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
SetTextAttributes
(
aText
);
m_gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb
_str
()
),
position
,
orientation
);
m_gal
->
StrokeText
(
std
::
wstring
(
aText
->
GetText
().
wc
_str
()
),
position
,
orientation
);
}
}
...
@@ -836,7 +835,7 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
...
@@ -836,7 +835,7 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
m_gal
->
SetLineWidth
(
text
.
GetThickness
()
);
m_gal
->
SetLineWidth
(
text
.
GetThickness
()
);
m_gal
->
SetTextAttributes
(
&
text
);
m_gal
->
SetTextAttributes
(
&
text
);
m_gal
->
StrokeText
(
std
::
string
(
text
.
GetText
().
mb
_str
()
),
position
,
orientation
);
m_gal
->
StrokeText
(
std
::
wstring
(
text
.
GetText
().
wc
_str
()
),
position
,
orientation
);
}
}
...
...
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