~scribus/scribus/trunk

« back to all changes in this revision

Viewing changes to scribus/plugins/import/pdf/slaoutput.cpp

  • Committer: jghali
  • Date: 2020-04-02 23:59:45 UTC
  • Revision ID: svn-v4:11d20701-8431-0410-a711-e3c959e3b870:trunk/Scribus:23554
#16083: Stroked text is not imported <Pontobart>

Show diffs side-by-side

added added

removed removed

Lines of Context:
3203
3203
 
3204
3204
void SlaOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, POPPLER_CONST_082 Unicode *u, int uLen)
3205
3205
{
 
3206
//      qDebug() << "SlaOutputDev::drawChar code:" << code << "bytes:" << nBytes << "Unicode:" << u << "ulen:" << uLen;
3206
3207
        double x1, y1, x2, y2;
3207
 
        int render;
3208
3208
        updateFont(state);
3209
3209
        if (!m_font)
3210
3210
                return;
3211
 
        // check for invisible text -- this is used by Acrobat Capture
3212
 
        render = state->getRender();
3213
 
        if (render == 3)
 
3211
 
 
3212
        // PDF 1.7 Section 9.3.6 defines eight text rendering modes.
 
3213
        // 0 - Fill
 
3214
        // 1 - Stroke
 
3215
        // 2 - First fill and then stroke
 
3216
        // 3 - Invisible
 
3217
        // 4 - Fill and use as a clipping path
 
3218
        // 5 - Stroke and use as a clipping path
 
3219
        // 6 - First fill, then stroke and add as a clipping path
 
3220
        // 7 - Only use as a clipping path.
 
3221
        // TODO Implement the clipping operations. At least the characters are shown.
 
3222
        int textRenderingMode = state->getRender();
 
3223
        // Invisible or only used for clipping
 
3224
        if (textRenderingMode == 3 || textRenderingMode == 7)
3214
3225
                return;
3215
 
        if (!(render & 1))
 
3226
        if (textRenderingMode < 8)
3216
3227
        {
3217
3228
                SplashPath * fontPath;
3218
3229
                fontPath = m_font->getGlyphPath(code);
3249
3260
                        FPoint wh = textPath.widthHeight();
3250
3261
                        if ((textPath.size() > 3) && ((wh.x() != 0.0) || (wh.y() != 0.0)))
3251
3262
                        {
3252
 
                                CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &CurrFillShade);
3253
 
                                int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, CurrColorFill, CommonStrings::None);
 
3263
                                int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, CommonStrings::None, CommonStrings::None);
3254
3264
                                PageItem* ite = m_doc->Items->at(z);
3255
3265
                                QTransform mm;
3256
3266
                                mm.scale(1, -1);
3260
3270
                                ite->PoLine = textPath.copy();
3261
3271
                                ite->ClipEdited = true;
3262
3272
                                ite->FrameType = 3;
3263
 
                                ite->setFillShade(CurrFillShade);
3264
 
                                ite->setFillEvenOdd(false);
3265
 
                                ite->setFillTransparency(1.0 - state->getFillOpacity());
3266
 
                                ite->setFillBlendmode(getBlendMode(state));
3267
3273
                                ite->setLineEnd(PLineEnd);
3268
3274
                                ite->setLineJoin(PLineJoin);
3269
3275
                                ite->setTextFlowMode(PageItem::TextFlowDisabled);
3270
 
                                m_doc->adjustItemSize(ite);
3271
 
                                if ((render & 3) == 1 || (render & 3) == 2)
3272
 
                                {
 
3276
                                // Fill text rendering modes. See above
 
3277
                                if (textRenderingMode == 0 || textRenderingMode == 2 || textRenderingMode == 4 || textRenderingMode == 6)
 
3278
                                {
 
3279
                                        CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &CurrFillShade);
 
3280
                                        ite->setFillColor(CurrColorFill);
 
3281
                                        ite->setFillShade(CurrFillShade);
 
3282
                                        ite->setFillEvenOdd(false);
 
3283
                                        ite->setFillTransparency(1.0 - state->getFillOpacity());
 
3284
                                        ite->setFillBlendmode(getBlendMode(state));
 
3285
                                }
 
3286
                                // Stroke text rendering modes. See above
 
3287
                                if (textRenderingMode == 1 || textRenderingMode == 2 || textRenderingMode == 5 || textRenderingMode == 6)
 
3288
                                {
 
3289
                                        CurrColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor(), &CurrStrokeShade);
3273
3290
                                        ite->setLineColor(CurrColorStroke);
3274
3291
                                        ite->setLineWidth(state->getTransformedLineWidth());
3275
3292
                                        ite->setLineTransparency(1.0 - state->getStrokeOpacity());
3276
3293
                                        ite->setLineBlendmode(getBlendMode(state));
3277
3294
                                        ite->setLineShade(CurrStrokeShade);
3278
3295
                                }
 
3296
                                m_doc->adjustItemSize(ite);
3279
3297
                                m_Elements->append(ite);
3280
3298
                                if (m_groupStack.count() != 0)
3281
3299
                                {