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
1d2e2e55
Commit
1d2e2e55
authored
Mar 16, 2015
by
Chris Pavlina
Committed by
Maciej Suminski
Mar 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final solution for the text overbar problem in GAL.
parent
e6db185f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
4 deletions
+37
-4
stroke_font.cpp
common/gal/stroke_font.cpp
+37
-4
No files found.
common/gal/stroke_font.cpp
View file @
1d2e2e55
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
using
namespace
KIGFX
;
using
namespace
KIGFX
;
const
double
STROKE_FONT
::
OVERBAR_HEIGHT
=
0.85
;
const
double
STROKE_FONT
::
OVERBAR_HEIGHT
=
1.22
;
const
double
STROKE_FONT
::
BOLD_FACTOR
=
1.3
;
const
double
STROKE_FONT
::
BOLD_FACTOR
=
1.3
;
const
double
STROKE_FONT
::
HERSHEY_SCALE
=
1.0
/
21.0
;
const
double
STROKE_FONT
::
HERSHEY_SCALE
=
1.0
/
21.0
;
...
@@ -235,6 +235,8 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
...
@@ -235,6 +235,8 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
double
xOffset
;
double
xOffset
;
VECTOR2D
glyphSize
(
m_glyphSize
);
VECTOR2D
glyphSize
(
m_glyphSize
);
double
overbar_italic_comp
;
bool
last_had_overbar
;
// Compute the text size
// Compute the text size
VECTOR2D
textSize
=
computeTextSize
(
aText
);
VECTOR2D
textSize
=
computeTextSize
(
aText
);
...
@@ -275,6 +277,11 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
...
@@ -275,6 +277,11 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
xOffset
=
0.0
;
xOffset
=
0.0
;
}
}
// The overbar is indented inward at the beginning of an italicized section, but
// must not be indented on subsequent letters to ensure that the bar segments
// overlap.
last_had_overbar
=
false
;
for
(
UTF8
::
uni_iter
chIt
=
aText
.
ubegin
(),
end
=
aText
.
uend
();
chIt
<
end
;
++
chIt
)
for
(
UTF8
::
uni_iter
chIt
=
aText
.
ubegin
(),
end
=
aText
.
uend
();
chIt
<
end
;
++
chIt
)
{
{
// Toggle overbar
// Toggle overbar
...
@@ -297,14 +304,40 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
...
@@ -297,14 +304,40 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
GLYPH
&
glyph
=
m_glyphs
[
dd
];
GLYPH
&
glyph
=
m_glyphs
[
dd
];
BOX2D
&
bbox
=
m_glyphBoundingBoxes
[
dd
];
BOX2D
&
bbox
=
m_glyphBoundingBoxes
[
dd
];
if
(
m_overbar
&&
m_italic
)
{
if
(
m_mirrored
)
{
overbar_italic_comp
=
(
-
m_glyphSize
.
y
*
OVERBAR_HEIGHT
)
/
8
;
}
else
{
overbar_italic_comp
=
(
m_glyphSize
.
y
*
OVERBAR_HEIGHT
)
/
8
;
}
}
if
(
m_overbar
)
if
(
m_overbar
)
{
{
VECTOR2D
startOverbar
(
xOffset
,
-
getInterline
()
*
OVERBAR_HEIGHT
);
double
overbar_start_x
=
xOffset
;
VECTOR2D
endOverbar
(
xOffset
+
glyphSize
.
x
*
bbox
.
GetEnd
().
x
,
double
overbar_start_y
=
-
m_glyphSize
.
y
*
OVERBAR_HEIGHT
;
-
getInterline
()
*
OVERBAR_HEIGHT
);
double
overbar_end_x
=
xOffset
+
glyphSize
.
x
*
bbox
.
GetEnd
().
x
;
double
overbar_end_y
=
-
m_glyphSize
.
y
*
OVERBAR_HEIGHT
;
if
(
!
last_had_overbar
)
{
overbar_start_x
+=
overbar_italic_comp
;
last_had_overbar
=
true
;
}
VECTOR2D
startOverbar
(
overbar_start_x
,
overbar_start_y
);
VECTOR2D
endOverbar
(
overbar_end_x
,
overbar_end_y
);
m_gal
->
DrawLine
(
startOverbar
,
endOverbar
);
m_gal
->
DrawLine
(
startOverbar
,
endOverbar
);
}
}
else
{
last_had_overbar
=
false
;
}
for
(
GLYPH
::
iterator
pointListIt
=
glyph
.
begin
();
pointListIt
!=
glyph
.
end
();
for
(
GLYPH
::
iterator
pointListIt
=
glyph
.
begin
();
pointListIt
!=
glyph
.
end
();
++
pointListIt
)
++
pointListIt
)
...
...
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