View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0016083 | Scribus | public | 2020-04-02 22:10 | 2020-04-05 19:37 | |
| Reporter | Pontobart | Assigned To | jghali | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.5.6.svn | ||||
| Fixed in Version | 1.5.6.svn | ||||
| Summary | 0016083: Stroked text is not imported | ||||
| Description | Stroked text is currently not imported. The attached patch fixes this. An example file and the LaTeX source code to generate it are also attached. | ||||
| Tags | No tags attached. | ||||
| Attached Files | stroke_text.diff (3,721 bytes)
Index: scribus/plugins/import/pdf/slaoutput.cpp
===================================================================
--- scribus/plugins/import/pdf/slaoutput.cpp (Revision 23553)
+++ scribus/plugins/import/pdf/slaoutput.cpp (Arbeitskopie)
@@ -3203,16 +3203,27 @@
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)
{
+// qDebug() << "SlaOutputDev::drawChar code:" << code << "bytes:" << nBytes << "Unicode:" << u << "ulen:" << uLen;
double x1, y1, x2, y2;
- int render;
updateFont(state);
if (!m_font)
return;
- // check for invisible text -- this is used by Acrobat Capture
- render = state->getRender();
- if (render == 3)
+
+ // PDF 1.7 Section 9.3.6 defines eight text rendering modes.
+ // 0 - Fill
+ // 1 - Stroke
+ // 2 - First fill and then stroke
+ // 3 - Invisible
+ // 4 - Fill and use as a clipping path
+ // 5 - Stroke and use as a clipping path
+ // 6 - First fill, then stroke and add as a clipping path
+ // 7 - Only use as a clipping path.
+ // TODO Implement the clipping operations. At least the characters are shown.
+ int textRenderingMode = state->getRender();
+ // Invisible or only used for clipping
+ if (textRenderingMode == 3 || textRenderingMode == 7)
return;
- if (!(render & 1))
+ if (textRenderingMode < 8)
{
SplashPath * fontPath;
fontPath = m_font->getGlyphPath(code);
@@ -3249,8 +3260,7 @@
FPoint wh = textPath.widthHeight();
if ((textPath.size() > 3) && ((wh.x() != 0.0) || (wh.y() != 0.0)))
{
- CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &CurrFillShade);
- int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, CurrColorFill, CommonStrings::None);
+ int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, CommonStrings::None, CommonStrings::None);
PageItem* ite = m_doc->Items->at(z);
QTransform mm;
mm.scale(1, -1);
@@ -3260,16 +3270,23 @@
ite->PoLine = textPath.copy();
ite->ClipEdited = true;
ite->FrameType = 3;
+ ite->setLineEnd(PLineEnd);
+ ite->setLineJoin(PLineJoin);
+ ite->setTextFlowMode(PageItem::TextFlowDisabled);
+ // Fill text rendering modes. See above
+ if (textRenderingMode == 0 || textRenderingMode == 2 || textRenderingMode == 4 || textRenderingMode == 6)
+ {
+ CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &CurrFillShade);
+ ite->setFillColor(CurrColorFill);
ite->setFillShade(CurrFillShade);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
- ite->setLineEnd(PLineEnd);
- ite->setLineJoin(PLineJoin);
- ite->setTextFlowMode(PageItem::TextFlowDisabled);
- m_doc->adjustItemSize(ite);
- if ((render & 3) == 1 || (render & 3) == 2)
+ }
+ // Stroke text rendering modes. See above
+ if (textRenderingMode == 1 || textRenderingMode == 2 || textRenderingMode == 5 || textRenderingMode == 6)
{
+ CurrColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor(), &CurrStrokeShade);
ite->setLineColor(CurrColorStroke);
ite->setLineWidth(state->getTransformedLineWidth());
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
@@ -3276,6 +3293,7 @@
ite->setLineBlendmode(getBlendMode(state));
ite->setLineShade(CurrStrokeShade);
}
+ m_doc->adjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
example.tex (1,211 bytes)
\documentclass{article}
\usepackage{tikz}
\usepackage{pdfrender}
\begin{document}
\pdfrender{TextRenderingMode=Fill}TextRenderingMode=Fill\newline
\pdfrender{TextRenderingMode=Stroke,LineWidth=0.2pt}TextRenderingMode=Stroke,LineWidth=0.2pt\newline
\pdfrender{TextRenderingMode=Stroke,LineWidth=0.5pt}TextRenderingMode=Stroke,LineWidth=0.5pt\newline
\pdfrender{TextRenderingMode=FillStroke,LineWidth=0.2pt,FillColor=blue}TextRenderingMode=FillStroke,LineWidth=0.2pt,FillColor=blue\newline
\pdfrender{TextRenderingMode=Invisible,LineWidth=0.2pt,FillColor=blue}TextRenderingMode=Invisible,LineWidth=0.2pt,FillColor=blue\newline
\pdfrender{TextRenderingMode=FillClip}TextRenderingMode=FillClip\newline
\pdfrender{TextRenderingMode=StrokeClip,LineWidth=0.2pt}TextRenderingMode=StrokeClip,LineWidth=0.2pt\newline
\pdfrender{TextRenderingMode=StrokeClip,LineWidth=0.5pt}TextRenderingMode=StrokeClip,LineWidth=0.5pt\newline
\pdfrender{TextRenderingMode=FillStrokeClip,LineWidth=0.2pt,FillColor=blue}TextRenderingMode=FillStrokeClip,LineWidth=0.2pt,FillColor=blue\newline
\pdfrender{TextRenderingMode=Clip,LineWidth=0.2pt,FillColor=blue}TextRenderingMode=Clip,LineWidth=0.2pt,FillColor=blue\newline
\end{document}
| ||||
| Patch | Yes | ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2020-04-02 22:10 | Pontobart | New Issue | |
| 2020-04-02 22:10 | Pontobart | File Added: stroke_text.diff | |
| 2020-04-02 22:10 | Pontobart | File Added: example.tex | |
| 2020-04-02 22:10 | Pontobart | File Added: 12.pdf | |
| 2020-04-03 00:00 | jghali | Assigned To | => jghali |
| 2020-04-03 00:00 | jghali | Status | new => resolved |
| 2020-04-03 00:00 | jghali | Resolution | open => fixed |
| 2020-04-03 00:00 | jghali | Fixed in Version | => 1.5.6.svn |
| 2020-04-03 00:00 | jghali | Note Added: 0047492 | |
| 2020-04-05 19:37 | cbradney | Status | resolved => closed |