Text rendering fix

This commit is contained in:
unknown 2010-10-15 18:08:59 +02:00
parent dd7f87242a
commit 76512a0870
10 changed files with 46 additions and 45 deletions

View file

@ -6,7 +6,6 @@ MOC_DIR = build
OBJECTS_DIR = build
RESOURCES = cockatrice.qrc
QT += network svg
CONFIG += debug
HEADERS += src/counter.h \
src/dlg_creategame.h \

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="600">
<rect fill="#ce1126" width="1200" height="200"/>
<rect fill="#fff" y="200" width="1200" height="200"/>
<rect fill="#ce1126" width="1200" height="200"/>
<rect fill="#fff" y="200" width="1200" height="200"/>
<rect fill="#008751" y="400" width="1200" height="200"/>
</svg>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="600">
<rect fill="#009B48" width="400" height="600"/>
<rect fill="#fff" x="400" width="400" height="600"/>
<rect fill="#009B48" width="400" height="600"/>
<rect fill="#fff" x="400" width="400" height="600"/>
<rect fill="#FF7900" x="800" width="400" height="600"/>
</svg>

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 269 B

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="900" height="600">
<rect fill="#fff" height="600" width="900"/>
<svg xmlns="http://www.w3.org/2000/svg" width="900" height="600">
<rect fill="#fff" height="600" width="900"/>
<circle fill="#bc002d" cx="450" cy="300" r="180"/>
</svg>

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 207 B

View file

@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="900" height="600" viewBox="0 0 9 6">
<rect fill="#21468B" width="9" height="6"/>
<rect fill="#FFF" width="9" height="4"/>
<rect fill="#AE1C28" width="9" height="2"/>
<svg xmlns="http://www.w3.org/2000/svg" width="900" height="600" viewBox="0 0 9 6">
<rect fill="#21468B" width="9" height="6"/>
<rect fill="#FFF" width="9" height="4"/>
<rect fill="#AE1C28" width="9" height="2"/>
</svg>

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 219 B

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="1600" height="1000" viewBox="0 0 16 10">
<rect width="16" height="10" fill="#005293"/>
<rect width="2" height="10" x="5" fill="#FECB00"/>
<rect width="16" height="2" y="4" fill="#FECB00"/>
</svg>
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="1600" height="1000" viewBox="0 0 16 10">
<rect width="16" height="10" fill="#005293"/>
<rect width="2" height="10" x="5" fill="#FECB00"/>
<rect width="16" height="2" y="4" fill="#FECB00"/>
</svg>

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 281 B

View file

@ -1,16 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="800" viewBox="0 0 360 240" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect fill="#e30a17" width="360" height="240"/>
<rect fill="#fff" width="8" height="240"/>
<circle fill="#fff" cx="128" cy="120" r="60"/>
<circle fill="#e30a17" cx="143" cy="120" r="48"/>
<g fill="#fff" transform="translate(205,120) scale(30) rotate(-90)">
<g id="g2">
<polygon id="g1" points="0,0 0,1 .5,1" transform="translate(0,-1) rotate(18)"/>
<use xlink:href="#g1" transform="scale(-1,1)"/>
</g>
<use xlink:href="#g2" transform="rotate(72)"/>
<use xlink:href="#g2" transform="rotate(-72)"/>
<use xlink:href="#g2" transform="rotate(144)"/>
<use xlink:href="#g2" transform="rotate(-144)"/>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="800" viewBox="0 0 360 240" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect fill="#e30a17" width="360" height="240"/>
<rect fill="#fff" width="8" height="240"/>
<circle fill="#fff" cx="128" cy="120" r="60"/>
<circle fill="#e30a17" cx="143" cy="120" r="48"/>
<g fill="#fff" transform="translate(205,120) scale(30) rotate(-90)">
<g id="g2">
<polygon id="g1" points="0,0 0,1 .5,1" transform="translate(0,-1) rotate(18)"/>
<use xlink:href="#g1" transform="scale(-1,1)"/>
</g>
<use xlink:href="#g2" transform="rotate(72)"/>
<use xlink:href="#g2" transform="rotate(-72)"/>
<use xlink:href="#g2" transform="rotate(144)"/>
<use xlink:href="#g2" transform="rotate(-144)"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 764 B

After

Width:  |  Height:  |  Size: 748 B

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1235" height="650">
<defs>
<polygon id="pt" points="-0.1624598481164531,0 0,-0.5 0.1624598481164531,0" transform="scale(0.0616)" fill="#FFF"/>
<g id="star"><use xlink:href="#pt" transform="rotate(-144)"/><use xlink:href="#pt" transform="rotate(-72)"/><use xlink:href="#pt"/><use xlink:href="#pt" transform="rotate(72)"/><use xlink:href="#pt" transform="rotate(144)"/></g>
<g id="s5"><use xlink:href="#star" x="-0.252"/><use xlink:href="#star" x="-0.126"/><use xlink:href="#star"/><use xlink:href="#star" x="0.126"/><use xlink:href="#star" x="0.252"/></g>
<g id="s6"><use xlink:href="#s5" x="-0.063"/><use xlink:href="#star" x="0.315"/></g>
<g id="x4"><use xlink:href="#s6"/><use xlink:href="#s5" y="0.054"/><use xlink:href="#s6" y="0.108"/><use xlink:href="#s5" y="0.162"/></g>
<g id="u"><use xlink:href="#x4" y="-0.216"/><use xlink:href="#x4"/><use xlink:href="#s6" y="0.216"/></g>
<rect id="stripe" width="1235" height="50" fill="#B22234"/>
</defs>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1235" height="650">
<defs>
<polygon id="pt" points="-0.1624598481164531,0 0,-0.5 0.1624598481164531,0" transform="scale(0.0616)" fill="#FFF"/>
<g id="star"><use xlink:href="#pt" transform="rotate(-144)"/><use xlink:href="#pt" transform="rotate(-72)"/><use xlink:href="#pt"/><use xlink:href="#pt" transform="rotate(72)"/><use xlink:href="#pt" transform="rotate(144)"/></g>
<g id="s5"><use xlink:href="#star" x="-0.252"/><use xlink:href="#star" x="-0.126"/><use xlink:href="#star"/><use xlink:href="#star" x="0.126"/><use xlink:href="#star" x="0.252"/></g>
<g id="s6"><use xlink:href="#s5" x="-0.063"/><use xlink:href="#star" x="0.315"/></g>
<g id="x4"><use xlink:href="#s6"/><use xlink:href="#s5" y="0.054"/><use xlink:href="#s6" y="0.108"/><use xlink:href="#s5" y="0.162"/></g>
<g id="u"><use xlink:href="#x4" y="-0.216"/><use xlink:href="#x4"/><use xlink:href="#s6" y="0.216"/></g>
<rect id="stripe" width="1235" height="50" fill="#B22234"/>
</defs>
<rect width="1235" height="650" fill="#FFF"/><use xlink:href="#stripe"/><use xlink:href="#stripe" y="100"/><use xlink:href="#stripe" y="200"/><use xlink:href="#stripe" y="300"/><use xlink:href="#stripe" y="400"/><use xlink:href="#stripe" y="500"/><use xlink:href="#stripe" y="600"/><rect width="494" height="350" fill="#3C3B6E"/><use xlink:href="#u" transform="translate(247,175) scale(650)"/></svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -118,7 +118,7 @@ void AbstractCardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *
transformPainter(painter, translatedSize);
painter->setPen(textColor);
painter->drawText(QRectF(2 * scaleFactor, 2 * scaleFactor, translatedSize.width() - 4 * scaleFactor, translatedSize.height() - 4 * scaleFactor), Qt::AlignTop | Qt::AlignLeft | Qt::TextWrapAnywhere, name);
painter->drawText(QRectF(4 * scaleFactor, 4 * scaleFactor, translatedSize.width() - 8 * scaleFactor, translatedSize.height() - 8 * scaleFactor), Qt::AlignTop | Qt::AlignLeft | Qt::TextWrapAnywhere, name);
}
painter->restore();

View file

@ -172,12 +172,14 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
if (!pt.isEmpty()) {
painter->save();
QSizeF translatedSize = getTranslatedSize(painter);
qreal scaleFactor = translatedSize.width() / boundingRect().width();
transformPainter(painter, translatedSize);
painter->setBackground(Qt::black);
painter->setBackgroundMode(Qt::OpaqueMode);
painter->setPen(Qt::white);
painter->drawText(QRectF(2, 2, translatedSize.width() - 4, translatedSize.height() - 4), Qt::AlignRight | Qt::AlignBottom, pt);
painter->drawText(QRectF(4 * scaleFactor, 4 * scaleFactor, translatedSize.width() - 8, translatedSize.height() - 8), Qt::AlignRight | Qt::AlignBottom, pt);
painter->restore();
}
if (getBeingPointedAt())