~ubuntu-branches/ubuntu/wily/scribus/wily-proposed

« back to all changes in this revision

Viewing changes to scribus/pdflib_core.cpp

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-09 21:50:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120209215056-2wrx1ara0jbm7fi5
Tags: 1.4.0.dfsg+r17287-1
* New upstream stable release upload into Debian (Closes: #654703).
* Applied the Ubuntu armel patch.
* Removed non-free color swatches from resources.
* debian/control:
  - Moved icc-profiles from Recommends to Suggests (Closes: #655885).
  - Updated Standards-Version to 3.9.2.
  - Updated extended description per lintian warning.
* debian/rules:
  - Update mailcap (Closes: #630751). A request for mime.types update has
    been sent to the mime-support maintainer.
  - Added build-arch and build-indep targets per lintian warning.
* debian/patches:
  - top_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't install the non-free "doc" dir.
  - profiles_cmakelists.patch - don't install non-free sRGB profile.
* debian/copyright: 
  - Converted to the DEP5 machine readable foramt.
  - Added licenses for free color swatches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
508
508
                jpgFileName = fn;
509
509
        else
510
510
        {
511
 
                tmpFile  = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.jpg");
 
511
                tmpFile  = QDir::toNativeSeparators(ScPaths::getTempFileDir() + "sc.jpg");
512
512
                if ((gray) && (!precal))
513
513
                        image.convertToGray();
514
514
                if (image.Convert2JPG(tmpFile, Options.Quality, cmyk, gray))
876
876
        else
877
877
                PutDoc("/Title "+EncStringUTF16("("+doc.documentInfo.getTitle()+")",2)+"\n");
878
878
        PutDoc("/Author "+EncStringUTF16("("+doc.documentInfo.getAuthor()+")",2)+"\n");
 
879
        PutDoc("/Subject "+EncStringUTF16("("+doc.documentInfo.getSubject()+")",2)+"\n");
879
880
        PutDoc("/Keywords "+EncStringUTF16("("+doc.documentInfo.getKeywords()+")",2)+"\n");
880
881
        PutDoc("/CreationDate "+EncString("("+Datum+")",2)+"\n");
881
882
        PutDoc("/ModDate "+EncString("("+Datum+")",2)+"\n");
1842
1843
                                        QVector<double>::iterator it;
1843
1844
                                        for ( it = ite->DashValues.begin(); it != ite->DashValues.end(); ++it )
1844
1845
                                        {
1845
 
                                                int da = static_cast<int>(*it);
 
1846
                                                double da = *it;
1846
1847
                                                // #8758: Custom dotted lines don't export properly to pdf
1847
1848
                                                // Null values have to be exported if line end != flat
1848
1849
                                                if ((da != 0) || (ite->lineEnd() != Qt::FlatCap))
1849
1850
                                                        PutPage(QString::number(da)+" ");
1850
1851
                                        }
1851
 
                                        PutPage("] "+QString::number(static_cast<int>(ite->DashOffset))+" d\n");
 
1852
                                        PutPage("] "+QString::number(ite->DashOffset)+" d\n");
1852
1853
                                }
1853
1854
                                else
1854
1855
                                        PutPage("["+getDashString(ite->PLineArt, ite->lineWidth())+"] 0 d\n");
1911
1912
                                                        else
1912
1913
                                                        {
1913
1914
                                                                PutPage(SetClipPath(ite));
1914
 
                                                                PutPage("h\nf*\n");
 
1915
                                                                PutPage(ite->fillRule ? "h\nf*\n" : "h\nf\n");
1915
1916
                                                        }
1916
1917
                                                }
1917
1918
                                                PutPage("q\n");
2011
2012
                                                        if (ite->fillColor() != CommonStrings::None)
2012
2013
                                                        {
2013
2014
                                                                PutPage(SetClipPath(ite));
2014
 
                                                                PutPage("h\nf*\n");
 
2015
                                                                PutPage(ite->fillRule ? "h\nf*\n" : "h\nf\n");
2015
2016
                                                        }
2016
2017
                                                }
2017
2018
                                                if ((ite->lineColor() != CommonStrings::None) || (!ite->NamedLStyle.isEmpty()))
2054
2055
                                                                if (ite->fillColor() != CommonStrings::None)
2055
2056
                                                                {
2056
2057
                                                                        PutPage(SetClipPath(ite));
2057
 
                                                                        PutPage("h\nf*\n");
 
2058
                                                                        PutPage(ite->fillRule ? "h\nf*\n" : "h\nf\n");
2058
2059
                                                                }
2059
2060
                                                        }
2060
2061
                                                }
2709
2710
        ll.LNr = 0;
2710
2711
        if (Options.UseLPI)
2711
2712
                PutPage("/"+HTName+" gs\n");
2712
 
        double bleedRight = 0.0;
2713
 
        double bleedLeft = 0.0;
2714
 
        double markOffs = 0.0;
 
2713
        double bleedRight  = 0.0;
 
2714
        double bleedLeft   = 0.0;
 
2715
        double bleedBottom = 0.0;
 
2716
        double bleedTop    = 0.0;
 
2717
        double markOffs    = 0.0;
2715
2718
        bleedDisplacementX = 0.0;
2716
2719
        bleedDisplacementY = 0.0;
2717
2720
        PutPage("q\n"); // Save
2720
2723
        // #8773 - incorrect page position if MPageNam.isEmpty()
2721
2724
        /*if (!pag->MPageNam.isEmpty())
2722
2725
        {*/
2723
 
                getBleeds(ActPageP, bleedLeft, bleedRight);
 
2726
                getBleeds(ActPageP, bleedLeft, bleedRight, bleedBottom, bleedTop);
2724
2727
                PutPage("1 0 0 1 "+FToStr(bleedLeft+markOffs)+" "+FToStr(Options.bleeds.Bottom+markOffs)+" cm\n");
2725
2728
                bleedDisplacementX = bleedLeft+markOffs;
2726
2729
                bleedDisplacementY = Options.bleeds.Bottom+markOffs;
2727
2730
        /*}*/
 
2731
        //#9385 : clip to BleedBox
 
2732
        if ((Options.cropMarks) || (Options.bleedMarks) || (Options.registrationMarks) || (Options.colorMarks) || (Options.docInfoMarks))
 
2733
        {
 
2734
                double bbWidth  = ActPageP->width()  + bleedLeft + bleedRight;
 
2735
                double bbHeight = ActPageP->height() + bleedBottom + bleedTop;
 
2736
                PutPage( QString("%1 %2 %3 %4 re W n\n").arg(FToStr(-bleedLeft)).arg(FToStr(-bleedBottom)).arg(FToStr(bbWidth)).arg(FToStr(bbHeight)) );
 
2737
        }
2728
2738
        if ( (Options.MirrorH) && (!pag->MPageNam.isEmpty()) )
2729
2739
                PutPage("-1 0 0 1 "+FToStr(ActPageP->width())+" 0 cm\n");
2730
2740
        if ( (Options.MirrorV) && (!pag->MPageNam.isEmpty()) )
3083
3093
                QVector<double>::iterator it;
3084
3094
                for ( it = ite->DashValues.begin(); it != ite->DashValues.end(); ++it )
3085
3095
                {
3086
 
                        int da = static_cast<int>(*it);
 
3096
                        double da = *it;
3087
3097
                        // #8758: Custom dotted lines don't export properly to pdf
3088
3098
                        // Null values have to be exported if line end != flat
3089
3099
                        if ((da != 0) || (ite->lineEnd() != Qt::FlatCap))
3090
3100
                                tmp += QString::number(da)+" ";
3091
3101
                }
3092
 
                tmp += "] "+QString::number(static_cast<int>(ite->DashOffset))+" d\n";
 
3102
                tmp += "] "+QString::number(ite->DashOffset)+" d\n";
3093
3103
        }
3094
3104
        else
3095
3105
                tmp += "["+getDashString(ite->PLineArt, ite->lineWidth())+"] 0 d\n";
3221
3231
                QVector<double>::iterator it;
3222
3232
                for ( it = ite->DashValues.begin(); it != ite->DashValues.end(); ++it )
3223
3233
                {
3224
 
                        int da = static_cast<int>(*it);
 
3234
                        double da = *it;
3225
3235
                        // #8758: Custom dotted lines don't export properly to pdf
3226
3236
                        // Null values have to be exported if line end != flat
3227
3237
                        if ((da != 0) || (ite->lineEnd() != Qt::FlatCap))
3228
3238
                                tmp += QString::number(da)+" ";
3229
3239
                }
3230
 
                tmp += "] "+QString::number(static_cast<int>(ite->DashOffset))+" d\n";
 
3240
                tmp += "] "+QString::number(ite->DashOffset)+" d\n";
3231
3241
        }
3232
3242
        else
3233
3243
                tmp += "["+getDashString(ite->PLineArt, ite->lineWidth())+"] 0 d\n";
3456
3466
                                if (ite->fillColor() != CommonStrings::None)
3457
3467
                                {
3458
3468
                                        tmp += SetClipPath(ite);
3459
 
                                        if (ite->fillRule)
3460
 
                                                tmp += "h\nf*\n";
3461
 
                                        else
3462
 
                                                tmp += "h\nf\n";
 
3469
                                        tmp += (ite->fillRule ? "h\nf*\n" : "h\nf\n");
3463
3470
                                }
3464
3471
                        }
3465
3472
                        if ((ite->lineColor() != CommonStrings::None) || (!ite->NamedLStyle.isEmpty()))
3895
3902
                        putColor(sl->Color, sl->Shade, false) +
3896
3903
                        FToStr(sl->Width)+" w\n"
3897
3904
                        );
3898
 
        QString Dt = FToStr(qMax(1*sl->Width, 1.0));
3899
 
        QString Sp = FToStr(qMax(2*sl->Width, 1.0));
3900
 
        QString Da = FToStr(qMax(4*sl->Width, 1.0));
3901
 
        switch (static_cast<Qt::PenStyle>(sl->Dash))
3902
 
        {
3903
 
                case Qt::SolidLine:
3904
 
                        tmp += "[] 0 d\n";
3905
 
                        break;
3906
 
                case Qt::DashLine:
3907
 
                        tmp += "["+Da+" "+Sp+"] 0 d\n";
3908
 
                        break;
3909
 
                case Qt::DotLine:
3910
 
                        tmp += "["+Dt+" "+Sp+"] 0 d\n";
3911
 
                        break;
3912
 
                case Qt::DashDotLine:
3913
 
                        tmp += "["+Da+" "+Sp+" "+Dt+" "+Sp+"] 0 d\n";
3914
 
                        break;
3915
 
                case Qt::DashDotDotLine:
3916
 
                        tmp += "["+Da+" "+Sp+" "+Dt+" "+Sp+" "+Dt+" "+Sp+"] 0 d\n";
3917
 
                        break;
3918
 
                default:
3919
 
                        tmp += "[] 0 d\n";
3920
 
                        break;
3921
 
                }
 
3905
        QString Ds = getDashString(sl->Dash, sl->Width);
 
3906
        tmp += Ds.isEmpty() ? "[] 0 d\n" : QString("[%1] 0 d\n").arg(Ds);
3922
3907
        switch (static_cast<Qt::PenCapStyle>(sl->LineEnd))
3923
3908
        {
3924
3909
                case Qt::FlatCap:
4238
4223
        }
4239
4224
        */
4240
4225
        InlineFrame& embedded(const_cast<InlineFrame&>(hl->embedded));
4241
 
        if ((hl->ch == SpecialChars::OBJECT) && (embedded.hasItem()))
 
4226
        if (hl->hasObject())
4242
4227
        {
4243
4228
                if (!ite->asPathText())
4244
4229
                {
4328
4313
                                QVector<double>::iterator it;
4329
4314
                                for ( it = embedded->DashValues.begin(); it != embedded->DashValues.end(); ++it )
4330
4315
                                {
4331
 
                                        int da = static_cast<int>(*it);
 
4316
                                        double da = *it;
4332
4317
                                        // #8758: Custom dotted lines don't export properly to pdf
4333
4318
                                        // Null values have to be exported if line end != flat
4334
4319
                                        if ((da != 0) || (embedded->lineEnd() != Qt::FlatCap))
4335
4320
                                                tmp2 += QString::number(da)+" ";
4336
4321
                                }
4337
 
                                tmp2 += "] "+QString::number(static_cast<int>(embedded->DashOffset))+" d\n";
 
4322
                                tmp2 += "] "+QString::number(embedded->DashOffset)+" d\n";
4338
4323
                        }
4339
4324
                        else
4340
4325
                                tmp2 += "["+getDashString(embedded->PLineArt, embedded->lineWidth())+"] 0 d\n";
5122
5107
                                QVector<double>::iterator it;
5123
5108
                                for ( it = item->DashValues.begin(); it != item->DashValues.end(); ++it )
5124
5109
                                {
5125
 
                                        int da = static_cast<int>(*it);
 
5110
                                        double da = *it;
5126
5111
                                        // #8758: Custom dotted lines don't export properly to pdf
5127
5112
                                        // Null values have to be exported if line end != flat
5128
5113
                                        if ((da != 0) || (item->lineEnd() != Qt::FlatCap))
5129
5114
                                                tmp2 += QString::number(da)+" ";
5130
5115
                                }
5131
 
                                tmp2 += "] "+QString::number(static_cast<int>(item->DashOffset))+" d\n";
 
5116
                                tmp2 += "] "+QString::number(item->DashOffset)+" d\n";
5132
5117
                        }
5133
5118
                        else
5134
5119
                                tmp2 += "["+getDashString(item->PLineArt, item->lineWidth())+"] 0 d\n";
5276
5261
                QString tmp = "/Pattern cs\n";
5277
5262
                tmp += "/Pattern"+QString::number(patObject)+" scn\n";
5278
5263
                tmp += SetClipPath(currItem);
5279
 
                if (currItem->fillRule)
5280
 
                        tmp += "h\nf*\n";
5281
 
                else
5282
 
                        tmp += "h\nf\n";
 
5264
                tmp += (currItem->fillRule ? "h\nf*\n" : "h\nf\n");
5283
5265
                ResCount++;
5284
5266
                output = tmp;
5285
5267
                return true;
5654
5636
                if ((Options.Version >= PDFOptions::PDFVersion_14) && ((Trans.at(c+1) != 1) || (Trans.at(c) != 1)))
5655
5637
                        tmp += "/"+TRes+" gs\n";
5656
5638
                tmp += SetClipPath(currItem);
5657
 
                tmp += "h\nW* n\n";
 
5639
                tmp += (currItem->fillRule ? "h\nW* n\n" : "h\nW n\n");
5658
5640
                tmp += "/"+ShName+" sh\nQ\n";
5659
5641
        }
5660
5642
        return tmp;
6740
6722
                {
6741
6723
                        if (extensionIndicatesEPSorPS(ext))
6742
6724
                        {
6743
 
                                QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.pdf");
 
6725
                                QString tmpFile = QDir::toNativeSeparators(ScPaths::getTempFileDir() + "sc.pdf");
6744
6726
                                QStringList opts;
6745
6727
                                opts.append("-dEPSCrop");
6746
6728
                                if (Options.Version >= PDFOptions::PDFVersion_14)