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
4c8aa301
Kaydet (Commit)
4c8aa301
authored
Haz 14, 2013
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
advance over font token during font name parsing
Change-Id: I457a4cae7907df6fc05535873ed51766c56220ee
üst
9d491e73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
39 deletions
+85
-39
wrapper.cxx
sdext/source/pdfimport/wrapper/wrapper.cxx
+85
-39
No files found.
sdext/source/pdfimport/wrapper/wrapper.cxx
Dosyayı görüntüle @
4c8aa301
...
@@ -169,10 +169,11 @@ class Parser
...
@@ -169,10 +169,11 @@ class Parser
void
readLink
();
void
readLink
();
void
readMaskedImage
();
void
readMaskedImage
();
void
readSoftMaskedImage
();
void
readSoftMaskedImage
();
int
parseFontCheckForString
(
const
sal_Unicode
*
pCopy
,
const
char
*
str
,
sal_Int32
&
nLen
,
sal_Int32
parseFontCheckForString
(
const
sal_Unicode
*
pCopy
,
sal_Int32
nCopyLen
,
FontAttributes
&
aResult
,
bool
bItalic
,
bool
bBold
);
const
char
*
pAttrib
,
sal_Int32
nAttribLen
,
int
parseFontRemoveSuffix
(
const
sal_Unicode
*
pCopy
,
const
char
*
s
,
sal_Int32
&
nLen
);
FontAttributes
&
rResult
,
bool
bItalic
,
bool
bBold
);
sal_Int32
parseFontRemoveSuffix
(
const
sal_Unicode
*
pCopy
,
sal_Int32
nCopyLen
,
const
char
*
pAttrib
,
sal_Int32
nAttribLen
);
public
:
public
:
Parser
(
const
ContentSinkSharedPtr
&
rSink
,
Parser
(
const
ContentSinkSharedPtr
&
rSink
,
...
@@ -459,41 +460,40 @@ rendering::ARGBColor Parser::readColor()
...
@@ -459,41 +460,40 @@ rendering::ARGBColor Parser::readColor()
return
aRes
;
return
aRes
;
}
}
int
Parser
::
parseFontCheckForString
(
const
sal_Unicode
*
pCopy
,
const
char
*
s
,
sal_Int32
&
nLen
,
sal_Int32
Parser
::
parseFontCheckForString
(
FontAttributes
&
aResult
,
bool
bItalic
,
bool
bBold
)
const
sal_Unicode
*
pCopy
,
sal_Int32
nCopyLen
,
const
char
*
pAttrib
,
sal_Int32
nAttribLen
,
FontAttributes
&
rResult
,
bool
bItalic
,
bool
bBold
)
{
{
int
l
=
strlen
(
s
);
if
(
nCopyLen
<
nAttribLen
)
if
(
nLen
<
l
)
return
0
;
return
0
;
for
(
int
i
=
0
;
i
<
l
;
i
++
)
for
(
sal_Int32
i
=
0
;
i
<
nAttribLen
;
++
i
)
if
(
tolower
(
pCopy
[
i
])
!=
s
[
i
]
if
(
tolower
(
pCopy
[
i
])
!=
pAttrib
[
i
]
&&
toupper
(
pCopy
[
i
])
!=
s
[
i
])
&&
toupper
(
pCopy
[
i
])
!=
pAttrib
[
i
])
return
0
;
return
0
;
aResult
.
isItalic
=
bItalic
;
rResult
.
isItalic
=
bItalic
;
aResult
.
isBold
=
bBold
;
rResult
.
isBold
=
bBold
;
nLen
-=
l
;
return
nAttribLen
;
pCopy
+=
l
;
return
l
;
}
}
int
Parser
::
parseFontRemoveSuffix
(
const
sal_Unicode
*
pCopy
,
const
char
*
s
,
sal_Int32
&
nLen
)
sal_Int32
Parser
::
parseFontRemoveSuffix
(
const
sal_Unicode
*
pCopy
,
sal_Int32
nCopyLen
,
const
char
*
pAttrib
,
sal_Int32
nAttribLen
)
{
{
int
l
=
strlen
(
s
);
if
(
nCopyLen
<
nAttribLen
)
if
(
nLen
<
l
)
return
0
;
return
0
;
for
(
int
i
=
0
;
i
<
l
;
i
++
)
for
(
sal_Int32
i
=
0
;
i
<
nAttribLen
;
++
i
)
if
(
pCopy
[
n
Len
-
l
+
i
]
!=
s
[
i
]
)
if
(
pCopy
[
n
CopyLen
-
nAttribLen
+
i
]
!=
pAttrib
[
i
]
)
return
0
;
return
0
;
nLen
-=
l
;
return
nAttribLen
;
return
l
;
}
}
void
Parser
::
parseFontFamilyName
(
FontAttributes
&
a
Result
)
void
Parser
::
parseFontFamilyName
(
FontAttributes
&
r
Result
)
{
{
OUStringBuffer
aNewFamilyName
(
a
Result
.
familyName
.
getLength
()
);
OUStringBuffer
aNewFamilyName
(
r
Result
.
familyName
.
getLength
()
);
const
sal_Unicode
*
pCopy
=
a
Result
.
familyName
.
getStr
();
const
sal_Unicode
*
pCopy
=
r
Result
.
familyName
.
getStr
();
sal_Int32
nLen
=
a
Result
.
familyName
.
getLength
();
sal_Int32
nLen
=
r
Result
.
familyName
.
getLength
();
// parse out truetype subsets (e.g. BAAAAA+Thorndale)
// parse out truetype subsets (e.g. BAAAAA+Thorndale)
if
(
nLen
>
8
&&
pCopy
[
6
]
==
sal_Unicode
(
'+'
)
)
if
(
nLen
>
8
&&
pCopy
[
6
]
==
sal_Unicode
(
'+'
)
)
{
{
...
@@ -503,17 +503,63 @@ void Parser::parseFontFamilyName( FontAttributes& aResult )
...
@@ -503,17 +503,63 @@ void Parser::parseFontFamilyName( FontAttributes& aResult )
while
(
nLen
)
while
(
nLen
)
{
{
if
(
parseFontRemoveSuffix
(
pCopy
,
"PSMT"
,
nLen
))
{}
if
(
parseFontRemoveSuffix
(
pCopy
,
nLen
,
RTL_CONSTASCII_STRINGPARAM
(
"PSMT"
)))
else
if
(
parseFontRemoveSuffix
(
pCopy
,
"MT"
,
nLen
))
{}
{
nLen
-=
RTL_CONSTASCII_LENGTH
(
"PSMT"
);
if
(
parseFontCheckForString
(
pCopy
,
"Italic"
,
nLen
,
aResult
,
true
,
false
))
{}
}
else
if
(
parseFontCheckForString
(
pCopy
,
"-Bold"
,
nLen
,
aResult
,
false
,
true
))
{}
else
if
(
parseFontRemoveSuffix
(
pCopy
,
nLen
,
RTL_CONSTASCII_STRINGPARAM
(
"MT"
)))
else
if
(
parseFontCheckForString
(
pCopy
,
"Bold"
,
nLen
,
aResult
,
false
,
true
))
{}
{
else
if
(
parseFontCheckForString
(
pCopy
,
"-Roman"
,
nLen
,
aResult
,
false
,
false
))
{}
nLen
-=
RTL_CONSTASCII_LENGTH
(
"MT"
);
else
if
(
parseFontCheckForString
(
pCopy
,
"-LightOblique"
,
nLen
,
aResult
,
true
,
false
))
{}
}
else
if
(
parseFontCheckForString
(
pCopy
,
"-BoldOblique"
,
nLen
,
aResult
,
true
,
true
))
{}
else
if
(
parseFontCheckForString
(
pCopy
,
"-Light"
,
nLen
,
aResult
,
false
,
false
))
{}
if
(
parseFontCheckForString
(
pCopy
,
nLen
,
RTL_CONSTASCII_STRINGPARAM
(
"Italic"
),
rResult
,
true
,
false
))
else
if
(
parseFontCheckForString
(
pCopy
,
"-Reg"
,
nLen
,
aResult
,
false
,
false
))
{}
{
sal_Int32
nAttribLen
=
RTL_CONSTASCII_LENGTH
(
"Italic"
);
nLen
-=
nAttribLen
;
pCopy
+=
nAttribLen
;
}
else
if
(
parseFontCheckForString
(
pCopy
,
nLen
,
RTL_CONSTASCII_STRINGPARAM
(
"-Bold"
),
rResult
,
false
,
true
))
{
sal_Int32
nAttribLen
=
RTL_CONSTASCII_LENGTH
(
"-Bold"
);
nLen
-=
nAttribLen
;
pCopy
+=
nAttribLen
;
}
else
if
(
parseFontCheckForString
(
pCopy
,
nLen
,
RTL_CONSTASCII_STRINGPARAM
(
"Bold"
),
rResult
,
false
,
true
))
{
sal_Int32
nAttribLen
=
RTL_CONSTASCII_LENGTH
(
"Bold"
);
nLen
-=
nAttribLen
;
pCopy
+=
nAttribLen
;
}
else
if
(
parseFontCheckForString
(
pCopy
,
nLen
,
RTL_CONSTASCII_STRINGPARAM
(
"-Roman"
),
rResult
,
false
,
false
))
{
sal_Int32
nAttribLen
=
RTL_CONSTASCII_LENGTH
(
"-Roman"
);
nLen
-=
nAttribLen
;
pCopy
+=
nAttribLen
;
}
else
if
(
parseFontCheckForString
(
pCopy
,
nLen
,
RTL_CONSTASCII_STRINGPARAM
(
"-LightOblique"
),
rResult
,
true
,
false
))
{
sal_Int32
nAttribLen
=
RTL_CONSTASCII_LENGTH
(
"-LightOblique"
);
nLen
-=
nAttribLen
;
pCopy
+=
nAttribLen
;
}
else
if
(
parseFontCheckForString
(
pCopy
,
nLen
,
RTL_CONSTASCII_STRINGPARAM
(
"-BoldOblique"
),
rResult
,
true
,
true
))
{
sal_Int32
nAttribLen
=
RTL_CONSTASCII_LENGTH
(
"-BoldOblique"
);
nLen
-=
nAttribLen
;
pCopy
+=
nAttribLen
;
}
else
if
(
parseFontCheckForString
(
pCopy
,
nLen
,
RTL_CONSTASCII_STRINGPARAM
(
"-Light"
),
rResult
,
false
,
false
))
{
sal_Int32
nAttribLen
=
RTL_CONSTASCII_LENGTH
(
"-Light"
);
nLen
-=
nAttribLen
;
pCopy
+=
nAttribLen
;
}
else
if
(
parseFontCheckForString
(
pCopy
,
nLen
,
RTL_CONSTASCII_STRINGPARAM
(
"-Reg"
),
rResult
,
false
,
false
))
{
sal_Int32
nAttribLen
=
RTL_CONSTASCII_LENGTH
(
"-Reg"
);
nLen
-=
nAttribLen
;
pCopy
+=
nAttribLen
;
}
else
else
{
{
if
(
*
pCopy
!=
'-'
)
if
(
*
pCopy
!=
'-'
)
...
@@ -522,7 +568,7 @@ void Parser::parseFontFamilyName( FontAttributes& aResult )
...
@@ -522,7 +568,7 @@ void Parser::parseFontFamilyName( FontAttributes& aResult )
nLen
--
;
nLen
--
;
}
}
}
}
a
Result
.
familyName
=
aNewFamilyName
.
makeStringAndClear
();
r
Result
.
familyName
=
aNewFamilyName
.
makeStringAndClear
();
}
}
void
Parser
::
readFont
()
void
Parser
::
readFont
()
...
...
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