Skip to content

Commit d02bfa0

Browse files
author
Otfried Cheong
committed
Add -notextsize flag
1 parent eca6ecc commit d02bfa0

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

pdftoipe/pdftoipe.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static bool printHelp = false;
3535
static bool math = false;
3636
static bool literal = false;
3737
static bool notext = false;
38+
static bool noTextSize = false;
3839

3940
static ArgDesc argDesc[] = {
4041
{"-f", argInt, &firstPage, 0,
@@ -53,7 +54,9 @@ static ArgDesc argDesc[] = {
5354
"allow math mode in input text objects"},
5455
{"-notext", argFlag, &notext, 0,
5556
"discard all text objects"},
56-
{"-merge", argInt, &mergeLevel, 0,
57+
{"-notextsize", argFlag, &noTextSize, 0,
58+
"ignore size of text objects"},
59+
{"-merge", argInt, &mergeLevel, 0,
5760
"how eagerly should consecutive text be merged: 0, 1, or 2 (default 0)"},
5861
{"-unicode", argInt, &unicodeLevel, 0,
5962
"how much Unicode should be used: 1, 2, or 3 (default 1)"},
@@ -132,7 +135,7 @@ int main(int argc, char *argv[])
132135
doc->getCatalog(), firstPage, lastPage);
133136

134137
// tell output device about text handling
135-
xmlOut->setTextHandling(math, notext, literal, mergeLevel, unicodeLevel);
138+
xmlOut->setTextHandling(math, notext, literal, mergeLevel, noTextSize, unicodeLevel);
136139

137140
int exitCode = 2;
138141
if (xmlOut->isOk()) {

pdftoipe/readme.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,14 @@ between v0.69 and v0.85 and cannot upgrade poppler easily, you need to
6767
look in the release history below and checkout the right release of
6868
the "ipe-tools" repository.
6969

70-
If you want to compile pdftoipe on Windows, please refer to
71-
"compile_on_windows.pdf", written by Daniel Beckmann. I have not been
72-
able to get this to work myself for recent versions of poppler.
73-
7470
--------------------------------------------------------------------
7571

7672
Changes
7773
=======
7874

75+
* 2021/09/08 (v7.2.24.1)
76+
Add -notextsize flag.
77+
7978
* 2020/09/09 (v7.2.20.1)
8079
Compatibility with poppler 0.86.0 (#47).
8180

pdftoipe/xmloutputdev.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,13 @@ XmlOutputDev::~XmlOutputDev()
102102

103103
void XmlOutputDev::setTextHandling(bool math, bool notext,
104104
bool literal, int mergeLevel,
105-
int unicodeLevel)
105+
bool noTextSize, int unicodeLevel)
106106
{
107107
iIsMath = math;
108108
iNoText = notext;
109109
iIsLiteral = literal;
110110
iMergeLevel = mergeLevel;
111+
iNoTextSize = noTextSize;
111112
iUnicodeLevel = unicodeLevel;
112113
if (iUnicodeLevel >= 2) {
113114
writePS("<ipestyle>\n");
@@ -297,10 +298,13 @@ void XmlOutputDev::startText(GfxState *state, double x, double y)
297298

298299
GfxRGB rgb;
299300
state->getFillRGB(&rgb);
300-
writeColor("<text stroke=", rgb, " pos=\"0 0\" transformations=\"affine\" ");
301+
writeColor("<text stroke=", rgb, " pos=\"0 0\" ");
302+
if (iNoTextSize)
303+
writePS("transformations=\"rigid\" ");
304+
else
305+
writePSFmt("transformations=\"affine\" size=\"%g\" ", state->getFontSize());
301306
writePS("valign=\"baseline\" ");
302-
writePSFmt("size=\"%g\" matrix=\"%g %g %g %g %g %g\">",
303-
state->getFontSize(), M[0], M[1], M[2], M[3], xt, yt);
307+
writePSFmt("matrix=\"%g %g %g %g %g %g\">", M[0], M[1], M[2], M[3], xt, yt);
304308

305309
if (iIsMath)
306310
writePS("$");

pdftoipe/xmloutputdev.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class GfxPath;
1515
class GfxFont;
1616

17-
#define PDFTOIPE_VERSION "2020/09/09"
17+
#define PDFTOIPE_VERSION "2021/09/08"
1818

1919
class XmlOutputDev : public OutputDev
2020
{
@@ -33,7 +33,7 @@ class XmlOutputDev : public OutputDev
3333
bool hasUnicode() const { return iUnicode; }
3434

3535
void setTextHandling(bool math, bool notext, bool literal,
36-
int mergeLevel, int unicodeLevel);
36+
int mergeLevel, bool noTextSize, int unicodeLevel);
3737

3838
//---- get info about output device
3939

@@ -99,6 +99,7 @@ class XmlOutputDev : public OutputDev
9999
bool iIsMath; // make text objects math formulas
100100
bool iNoText; // discard text objects
101101
bool inText; // inside a text object
102+
bool iNoTextSize; // all text objects at normal size
102103
int iMergeLevel; // text merge level
103104
int iUnicodeLevel; // unicode handling
104105
};

0 commit comments

Comments
 (0)