Commit 56ae57c1 authored by Oliver Sander's avatar Oliver Sander

Reimplement type3 font rendering for the Arthur backend

The new implementation uses beginType3Char/endType3Char.
It is *much* simpler than the previous implementation.

This patch does not remove the old implementation.  You can
switch between the two by setting the return value of
the method interpretType3Chars (true: new implementation,
false: old implementation).
parent 63ca4951
Pipeline #94476 passed with stage
in 3 minutes and 42 seconds
......@@ -991,6 +991,44 @@ void ArthurOutputDev::drawChar(GfxState *state, double x, double y,
}
}
bool ArthurOutputDev::beginType3Char(GfxState *state, double x, double y,
double dx, double dy,
CharCode code, const Unicode *u, int uLen)
{
// Store the QPainter state; we need to modify it temporarily
m_painter.top()->save();
// Make the glyph position the coordinate origin -- that's our center of scaling
m_painter.top()->translate(QPointF(x, y));
const double* mat = state->getFont()->getFontMatrix();
QTransform fontMatrix(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
// Scale with the font size
fontMatrix.scale(state->getFontSize(), state->getFontSize());
m_painter.top()->setTransform(fontMatrix,true);
// Apply the text matrix on top
const double *textMat = state->getTextMat();
QTransform textTransform(textMat[0] * state->getHorizScaling(),
textMat[1] * state->getHorizScaling(),
textMat[2],
textMat[3],
0,
0);
m_painter.top()->setTransform(textTransform,true);
return false;
}
void ArthurOutputDev::endType3Char(GfxState *state)
{
// Restore transformation
m_painter.top()->restore();
}
void ArthurOutputDev::type3D0(GfxState *state, double wx, double wy)
{
}
......
......@@ -90,7 +90,7 @@ public:
// Does this device use beginType3Char/endType3Char? Otherwise,
// text in Type 3 fonts will be drawn with drawChar/drawString.
bool interpretType3Chars() override { return false; }
bool interpretType3Chars() override { return true; }
//----- initialization and control
......@@ -162,6 +162,10 @@ public:
bool maskInterpolate) override;
//----- Type 3 font operators
bool beginType3Char(GfxState *state, double x, double y,
double dx, double dy,
CharCode code, const Unicode *u, int uLen) override;
void endType3Char(GfxState *state) override;
void type3D0(GfxState *state, double wx, double wy) override;
void type3D1(GfxState *state, double wx, double wy,
double llx, double lly, double urx, double ury) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment