Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
def95cfb
Kaydet (Commit)
def95cfb
authored
Haz 18, 2013
tarafından
Armin Le Grand
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
i122524 fixed/added some text import aspects for super/sub-baseline
üst
8f9af2d0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
152 additions
and
2 deletions
+152
-2
svgstyleattributes.hxx
svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+18
-0
svgtoken.hxx
svgio/inc/svgio/svgreader/svgtoken.hxx
+1
-0
svgcharacternode.cxx
svgio/source/svgreader/svgcharacternode.cxx
+32
-0
svgdocumenthandler.cxx
svgio/source/svgreader/svgdocumenthandler.cxx
+21
-1
svgnode.cxx
svgio/source/svgreader/svgnode.cxx
+1
-1
svgstyleattributes.cxx
svgio/source/svgreader/svgstyleattributes.cxx
+77
-0
svgtoken.cxx
svgio/source/svgreader/svgtoken.cxx
+2
-0
No files found.
svgio/inc/svgio/svgreader/svgstyleattributes.hxx
Dosyayı görüntüle @
def95cfb
...
...
@@ -146,6 +146,15 @@ namespace svgio
FillRule_evenodd
};
enum
BaselineShift
{
BaselineShift_Baseline
,
BaselineShift_Sub
,
BaselineShift_Super
,
BaselineShift_Percentage
,
BaselineShift_Length
};
class
SvgStyleAttributes
{
private
:
...
...
@@ -199,6 +208,10 @@ namespace svgio
// ClipRule setting (only valid wne mbIsClipPathContent == true, default is FillRule_nonzero)
FillRule
maClipRule
;
// BaselineShift: Type and number (in case of BaselineShift_Percentage or BaselineShift_Length)
BaselineShift
maBaselineShift
;
SvgNumber
maBaselineShiftNumber
;
/// bitfield
// defines if this attributes are part of a ClipPath. If yes,
...
...
@@ -425,6 +438,11 @@ namespace svgio
const
SvgMarkerNode
*
accessMarkerEndXLink
()
const
;
void
setMarkerEndXLink
(
const
rtl
::
OUString
&
rNew
)
{
maMarkerEndXLink
=
rNew
;
}
// BaselineShift
void
setBaselineShift
(
const
BaselineShift
aBaselineShift
=
BaselineShift_Baseline
)
{
maBaselineShift
=
aBaselineShift
;
}
BaselineShift
getBaselineShift
()
const
{
return
maBaselineShift
;
}
void
setBaselineShiftNumber
(
const
SvgNumber
&
rBaselineShift
=
SvgNumber
())
{
maBaselineShiftNumber
=
rBaselineShift
;
}
SvgNumber
getBaselineShiftNumber
()
const
;
};
}
// end of namespace svgreader
}
// end of namespace svgio
...
...
svgio/inc/svgio/svgreader/svgtoken.hxx
Dosyayı görüntüle @
def95cfb
...
...
@@ -181,6 +181,7 @@ namespace svgio
// text tokens
SVGTokenText
,
SVGTokenBaselineShift
,
SVGTokenLast
};
...
...
svgio/source/svgreader/svgcharacternode.cxx
Dosyayı görüntüle @
def95cfb
...
...
@@ -408,6 +408,38 @@ namespace svgio
}
}
// get BaselineShift
const
BaselineShift
aBaselineShift
(
rSvgStyleAttributes
.
getBaselineShift
());
// apply BaselineShift
switch
(
aBaselineShift
)
{
case
BaselineShift_Sub
:
{
aPosition
.
setY
(
aPosition
.
getY
()
+
aTextLayouterDevice
.
getUnderlineOffset
());
break
;
}
case
BaselineShift_Super
:
{
aPosition
.
setY
(
aPosition
.
getY
()
+
aTextLayouterDevice
.
getOverlineOffset
());
break
;
}
case
BaselineShift_Percentage
:
case
BaselineShift_Length
:
{
const
SvgNumber
aNumber
(
rSvgStyleAttributes
.
getBaselineShiftNumber
());
const
double
mfBaselineShift
(
aNumber
.
solve
(
*
this
,
length
));
aPosition
.
setY
(
aPosition
.
getY
()
+
mfBaselineShift
);
break
;
}
default
:
// BaselineShift_Baseline
{
// nothing to do
break
;
}
}
// get fill color
const
basegfx
::
BColor
aFill
(
rSvgStyleAttributes
.
getFill
()
?
*
rSvgStyleAttributes
.
getFill
()
...
...
svgio/source/svgreader/svgdocumenthandler.cxx
Dosyayı görüntüle @
def95cfb
...
...
@@ -86,9 +86,29 @@ namespace
{
if
(
pLast
)
{
bool
bAddGap
(
true
);
static
bool
bNoGapsForBaselineShift
(
true
);
if
(
bNoGapsForBaselineShift
)
{
// With this option a baseline shift between two char parts ('words')
// will not add a space 'gap' to the end of the (non-last) word. This
// seems to be the standard behaviour, see last bugdoc attached #122524#
const
svgio
::
svgreader
::
SvgStyleAttributes
*
pStyleLast
=
pLast
->
getSvgStyleAttributes
();
const
svgio
::
svgreader
::
SvgStyleAttributes
*
pStyleCurrent
=
pCandidate
->
getSvgStyleAttributes
();
if
(
pStyleLast
&&
pStyleCurrent
&&
pStyleLast
->
getBaselineShift
()
!=
pStyleCurrent
->
getBaselineShift
())
{
bAddGap
=
false
;
}
}
// add in-between whitespace (single space) to last
// known character node
pLast
->
addGap
();
if
(
bAddGap
)
{
pLast
->
addGap
();
}
}
// remember new last corected character node
...
...
svgio/source/svgreader/svgnode.cxx
Dosyayı görüntüle @
def95cfb
...
...
@@ -210,7 +210,7 @@ namespace svgio
}
else
{
parseAttribute
(
aTokenName
,
StrToSVGToken
(
aTokenName
)
,
xAttribs
->
getValueByIndex
(
a
));
parseAttribute
(
aTokenName
,
aSVGToken
,
xAttribs
->
getValueByIndex
(
a
));
}
}
...
...
svgio/source/svgreader/svgstyleattributes.cxx
Dosyayı görüntüle @
def95cfb
...
...
@@ -1169,6 +1169,8 @@ namespace svgio
mpMarkerEndXLink
(
0
),
maFillRule
(
FillRule_notset
),
maClipRule
(
FillRule_nonzero
),
maBaselineShift
(
BaselineShift_Baseline
),
maBaselineShiftNumber
(
0
),
mbIsClipPathContent
(
SVGTokenClipPathNode
==
mrOwner
.
getType
()),
mbStrokeDasharraySet
(
false
)
{
...
...
@@ -1803,6 +1805,43 @@ namespace svgio
}
break
;
}
case
SVGTokenBaselineShift
:
{
if
(
aContent
.
getLength
())
{
static
rtl
::
OUString
aStrSub
(
rtl
::
OUString
::
createFromAscii
(
"sub"
));
static
rtl
::
OUString
aStrSuper
(
rtl
::
OUString
::
createFromAscii
(
"super"
));
SvgNumber
aNum
;
if
(
aContent
.
match
(
aStrSub
))
{
setBaselineShift
(
BaselineShift_Sub
);
}
else
if
(
aContent
.
match
(
aStrSuper
))
{
setBaselineShift
(
BaselineShift_Super
);
}
else
if
(
readSingleNumber
(
aContent
,
aNum
))
{
setBaselineShiftNumber
(
aNum
);
if
(
Unit_percent
==
aNum
.
getUnit
())
{
setBaselineShift
(
BaselineShift_Percentage
);
}
else
{
setBaselineShift
(
BaselineShift_Length
);
}
}
else
{
// no BaselineShift or inherit (which is automatically)
setBaselineShift
(
BaselineShift_Baseline
);
}
}
break
;
}
default
:
{
break
;
...
...
@@ -2184,6 +2223,24 @@ namespace svgio
{
if
(
maFontSize
.
isSet
())
{
// #122524# Handle Unit_percent realtive to parent FontSize (see SVG1.1
// spec 10.10 Font selection properties font-size, lastline (klick 'normative
// definition of the property')
if
(
Unit_percent
==
maFontSize
.
getUnit
())
{
const
SvgStyleAttributes
*
pSvgStyleAttributes
=
getParentStyle
();
if
(
pSvgStyleAttributes
)
{
const
SvgNumber
aParentNumber
=
pSvgStyleAttributes
->
getFontSize
();
return
SvgNumber
(
aParentNumber
.
getNumber
()
*
maFontSize
.
getNumber
()
*
0.01
,
aParentNumber
.
getUnit
(),
true
);
}
}
return
maFontSize
;
}
...
...
@@ -2472,6 +2529,26 @@ namespace svgio
return
mpMarkerEndXLink
;
}
SvgNumber
SvgStyleAttributes
::
getBaselineShiftNumber
()
const
{
// #122524# Handle Unit_percent realtive to parent BaselineShift
if
(
Unit_percent
==
maBaselineShiftNumber
.
getUnit
())
{
const
SvgStyleAttributes
*
pSvgStyleAttributes
=
getParentStyle
();
if
(
pSvgStyleAttributes
)
{
const
SvgNumber
aParentNumber
=
pSvgStyleAttributes
->
getBaselineShiftNumber
();
return
SvgNumber
(
aParentNumber
.
getNumber
()
*
maBaselineShiftNumber
.
getNumber
()
*
0.01
,
aParentNumber
.
getUnit
(),
true
);
}
}
return
maBaselineShiftNumber
;
}
}
// end of namespace svgreader
}
// end of namespace svgio
...
...
svgio/source/svgreader/svgtoken.cxx
Dosyayı görüntüle @
def95cfb
...
...
@@ -165,6 +165,7 @@ namespace svgio
static
rtl
::
OUString
aSVGStrStrokeWidth
(
rtl
::
OUString
::
createFromAscii
(
"stroke-width"
));
static
rtl
::
OUString
aSVGStrText
(
rtl
::
OUString
::
createFromAscii
(
"text"
));
static
rtl
::
OUString
aSVGStrBaselineShift
(
rtl
::
OUString
::
createFromAscii
(
"baseline-shift"
));
SVGToken
StrToSVGToken
(
const
rtl
::
OUString
&
rStr
)
{
...
...
@@ -307,6 +308,7 @@ namespace svgio
aSVGTokenMapperList
.
insert
(
SVGTokenValueType
(
aSVGStrStrokeWidth
,
SVGTokenStrokeWidth
));
aSVGTokenMapperList
.
insert
(
SVGTokenValueType
(
aSVGStrText
,
SVGTokenText
));
aSVGTokenMapperList
.
insert
(
SVGTokenValueType
(
aSVGStrBaselineShift
,
SVGTokenBaselineShift
));
}
const
SVGTokenMapper
::
const_iterator
aResult
(
aSVGTokenMapperList
.
find
(
rStr
));
...
...
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