mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
do not synthesize bold and italic glyphs
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
d53c24dfef
commit
459fe1969e
5 changed files with 3 additions and 60 deletions
|
@ -229,8 +229,7 @@ set_package_properties(X11 PROPERTIES
|
|||
TYPE REQUIRED
|
||||
)
|
||||
|
||||
# v2.1.10+ required for FT_GlyphSlot_Embolden()
|
||||
find_package(Freetype 2.1.10)
|
||||
find_package(Freetype)
|
||||
set_package_properties(Freetype PROPERTIES
|
||||
PURPOSE "Required for fonts configuration support"
|
||||
DESCRIPTION "Freely available software library to render fonts"
|
||||
|
|
|
@ -1776,9 +1776,7 @@ void QPdfBaseEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &t
|
|||
|
||||
*currentPage << "BT\n"
|
||||
<< "/F" << font->object_id << size << "Tf "
|
||||
<< stretch << (synthesized & QFontEngine::SynthesizedItalic
|
||||
? "0 .3 -1 0 0 Tm\n"
|
||||
: "0 0 -1 0 0 Tm\n");
|
||||
<< stretch << "0 0 -1 0 0 Tm\n";
|
||||
|
||||
|
||||
#if 0
|
||||
|
@ -1809,8 +1807,6 @@ void QPdfBaseEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &t
|
|||
for (int i = 0; i < glyphs.size(); ++i) {
|
||||
qreal x = positions[i].x.toReal();
|
||||
qreal y = positions[i].y.toReal();
|
||||
if (synthesized & QFontEngine::SynthesizedItalic)
|
||||
x += .3*y;
|
||||
x /= stretch;
|
||||
QSTACKARRAY(char, buf, 5);
|
||||
int g = font->addGlyph(glyphs[i]);
|
||||
|
@ -1819,28 +1815,6 @@ void QPdfBaseEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &t
|
|||
last_x = x;
|
||||
last_y = y;
|
||||
}
|
||||
if (synthesized & QFontEngine::SynthesizedBold) {
|
||||
*currentPage << stretch << (synthesized & QFontEngine::SynthesizedItalic
|
||||
? "0 .3 -1 0 0 Tm\n"
|
||||
: "0 0 -1 0 0 Tm\n");
|
||||
*currentPage << "/Span << /ActualText <> >> BDC\n";
|
||||
last_x = 0.5*fe->lineThickness().toReal();
|
||||
last_y = 0.;
|
||||
for (int i = 0; i < glyphs.size(); ++i) {
|
||||
qreal x = positions[i].x.toReal();
|
||||
qreal y = positions[i].y.toReal();
|
||||
if (synthesized & QFontEngine::SynthesizedItalic)
|
||||
x += .3*y;
|
||||
x /= stretch;
|
||||
QSTACKARRAY(char, buf, 5);
|
||||
int g = font->addGlyph(glyphs[i]);
|
||||
*currentPage << x - last_x << last_y - y << "Td <"
|
||||
<< QPdf::toHex((ushort)g, buf) << "> Tj\n";
|
||||
last_x = x;
|
||||
last_y = y;
|
||||
}
|
||||
*currentPage << "EMC\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
*currentPage << "ET\n";
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_SYNTHESIS_H
|
||||
#include FT_TRUETYPE_TABLES_H
|
||||
#include FT_TYPE1_TABLES_H
|
||||
#include FT_GLYPH_H
|
||||
|
@ -210,8 +209,6 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd, FcPattern *pattern)
|
|||
: default_load_flags(FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH | FT_LOAD_NO_BITMAP),
|
||||
default_hint_style(HintNone),
|
||||
freetype(nullptr),
|
||||
embolden(false),
|
||||
oblique(false),
|
||||
xsize(0),
|
||||
ysize(0),
|
||||
line_thickness(QFixed::fromFixed(1)),
|
||||
|
@ -249,8 +246,6 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd)
|
|||
: default_load_flags(FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH | FT_LOAD_NO_BITMAP),
|
||||
default_hint_style(HintNone),
|
||||
freetype(nullptr),
|
||||
embolden(false),
|
||||
oblique(false),
|
||||
xsize(0),
|
||||
ysize(0),
|
||||
line_thickness(QFixed::fromFixed(1)),
|
||||
|
@ -280,14 +275,6 @@ void QFontEngineFT::init()
|
|||
|
||||
setFace(QFontEngineFT::Scaled);
|
||||
FT_Face face = getFace();
|
||||
// fake italic/oblique
|
||||
if ((fontDef.style != QFont::StyleNormal) && !(face->style_flags & FT_STYLE_FLAG_ITALIC)) {
|
||||
oblique = true;
|
||||
}
|
||||
// fake bold
|
||||
if ((fontDef.weight == QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face)) {
|
||||
embolden = true;
|
||||
}
|
||||
// underline metrics
|
||||
line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale));
|
||||
underline_position = QFixed::fromFixed(-FT_MulFix(face->underline_position, face->size->metrics.y_scale));
|
||||
|
@ -356,13 +343,6 @@ bool QFontEngineFT::loadGlyph(glyph_t glyph, int load_flags) const
|
|||
return false;
|
||||
}
|
||||
|
||||
if (embolden) {
|
||||
FT_GlyphSlot_Embolden(slot);
|
||||
}
|
||||
if (oblique) {
|
||||
FT_GlyphSlot_Oblique(slot);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -428,12 +408,6 @@ bool QFontEngineFT::getSfntTableData(uint tag, uchar *buffer, uint *length) cons
|
|||
int QFontEngineFT::synthesized() const
|
||||
{
|
||||
int result = 0;
|
||||
if (oblique) {
|
||||
result = SynthesizedItalic;
|
||||
}
|
||||
if (embolden) {
|
||||
result |= SynthesizedBold;
|
||||
}
|
||||
if (fontDef.stretch != 100) {
|
||||
result |= SynthesizedStretch;
|
||||
}
|
||||
|
|
|
@ -165,8 +165,6 @@ private:
|
|||
QFontMetric* getMetrics(glyph_t glyph) const;
|
||||
|
||||
QFreetypeFace *freetype;
|
||||
bool embolden;
|
||||
bool oblique;
|
||||
QFontEngine::FaceId face_id;
|
||||
|
||||
int xsize;
|
||||
|
|
|
@ -94,9 +94,7 @@ public:
|
|||
};
|
||||
virtual FaceId faceId() const { return FaceId(); }
|
||||
enum SynthesizedFlags {
|
||||
SynthesizedItalic = 0x1,
|
||||
SynthesizedBold = 0x2,
|
||||
SynthesizedStretch = 0x4
|
||||
SynthesizedStretch = 0x1
|
||||
};
|
||||
virtual int synthesized() const { return 0; }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue