Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
767b00e9
Commit
767b00e9
authored
Jun 15, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
found a workaround for the crossplaform font problem
parent
0a839511
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
43 deletions
+14
-43
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+14
-43
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
767b00e9
...
@@ -2268,50 +2268,22 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::textItemToSvg(UBGraphicsTextItem* it
...
@@ -2268,50 +2268,22 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::textItemToSvg(UBGraphicsTextItem* it
,
"fill-on-light-background"
,
colorLightBg
.
name
());
,
"fill-on-light-background"
,
colorLightBg
.
name
());
//for new documents from version 4.5.0
//for new documents from version 4.5.0
if
(
true
)
{
mXmlWriter
.
writeStartElement
(
"itemTextContent"
);
mXmlWriter
.
writeStartElement
(
"itemTextContent"
);
mXmlWriter
.
writeCDATA
(
item
->
toHtml
());
//TODO:
mXmlWriter
.
writeEndElement
();
//itemTextContent
// This is only a workaround that works quite well. The font sizes are expressed on
// px instead of pt because px is less sensitive to the physicalDPI of the Os. The
//tracking for back capability with older versions
// main problem in fact appears when the file is used on another platform than the
}
else
if
(
false
)
{
// one used to create it.
mXmlWriter
.
writeStartElement
(
nsXHtml
,
"body"
);
// But a different solution has to be implemented to avoid some annoying case that
mXmlWriter
.
writeStartElement
(
nsXHtml
,
"div"
);
// are already present with this hack.
mXmlWriter
.
writeStartElement
(
nsXHtml
,
"font"
);
QString
htmlString
=
item
->
toHtml
();
QRegExp
regExp
(
"font-size:([0-9]{,3})pt"
);
QFont
font
=
item
->
font
();
htmlString
=
htmlString
.
replace
(
regExp
,
"font-size:
\\
1px"
);
mXmlWriter
.
writeCDATA
(
htmlString
);
mXmlWriter
.
writeAttribute
(
"face"
,
font
.
family
());
mXmlWriter
.
writeEndElement
();
//itemTextContent
QFontInfo
fi
(
font
);
int
pixelSize
=
fi
.
pixelSize
();
mXmlWriter
.
writeAttribute
(
"style"
,
sFontSizePrefix
+
QString
(
" %1"
).
arg
(
pixelSize
)
+
sPixelUnit
+
"; "
+
sFontWeightPrefix
+
" "
+
(
fi
.
bold
()
?
"bold"
:
"normal"
)
+
"; "
+
sFontStylePrefix
+
" "
+
(
fi
.
italic
()
?
"italic"
:
"normal"
)
+
";"
);
mXmlWriter
.
writeAttribute
(
"color"
,
item
->
defaultTextColor
().
name
());
QString
text
=
item
->
toPlainText
();
QStringList
lines
=
text
.
split
(
"
\n
"
);
for
(
int
i
=
0
;
i
<
lines
.
length
()
;
i
++
)
{
mXmlWriter
.
writeCharacters
(
lines
.
at
(
i
));
if
(
i
<
lines
.
length
()
-
1
)
mXmlWriter
.
writeEmptyElement
(
nsXHtml
,
"br"
);
}
mXmlWriter
.
writeEndElement
();
//font
mXmlWriter
.
writeEndElement
();
//div
mXmlWriter
.
writeEndElement
();
//body
}
mXmlWriter
.
writeEndElement
();
//foreignObject
mXmlWriter
.
writeEndElement
();
//foreignObject
// QtLogger::start("/home/ilia/Documents/tmp/10/log.log");
// QtLogger::appendl(item->toHtml());
// QtLogger::finish();
}
}
UBGraphicsTextItem
*
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
textItemFromSvg
()
UBGraphicsTextItem
*
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
textItemFromSvg
()
...
@@ -2361,7 +2333,6 @@ UBGraphicsTextItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::textItemFromSvg()
...
@@ -2361,7 +2333,6 @@ UBGraphicsTextItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::textItemFromSvg()
text
=
mXmlReader
.
readElementText
();
text
=
mXmlReader
.
readElementText
();
textItem
->
setHtml
(
text
);
textItem
->
setHtml
(
text
);
textItem
->
resize
(
width
,
height
);
textItem
->
resize
(
width
,
height
);
if
(
textItem
->
toPlainText
().
isEmpty
())
{
if
(
textItem
->
toPlainText
().
isEmpty
())
{
delete
textItem
;
delete
textItem
;
textItem
=
0
;
textItem
=
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