Bug 98814 - width set to 0 for vertical text
Summary: width set to 0 for vertical text
Status: RESOLVED MOVED
Alias: None
Product: poppler
Classification: Unclassified
Component: pdftohtml (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-22 08:44 UTC by perrotton
Modified: 2018-08-21 10:42 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
pdf with vertical text (1.32 MB, application/pdf)
2016-11-22 08:44 UTC, perrotton
Details

Description perrotton 2016-11-22 08:44:39 UTC
Created attachment 128140 [details]
pdf with vertical text

I'm trying to transform a pdf to html file using 'pdftohtml' that contain japanese langage.
Everything is fine with horizontal text but each generated div for vertical text has width set to 0.

I tried to fix this and I have found this in following function GfxCIDFont::getNextChar() :

...
  // vertical
  } else {
    w = 0;
...

and width doesn't seem to be updated later. So I have tried to do like in horizontal mode :

...
  // vertical
  } else {
    w =getWidth(cid);
...

the result is good, all my divs have a width. Is it the right way ? 
(there is a pdf exemple on attachment)
Comment 1 perrotton 2016-11-22 10:51:47 UTC
my last fix proposition wasn't good enough, actually a shift (x coordonate) was gradually added for each characters on same vertical line.

I found a solution,in function Gfx::doShowText() :

I changed : 
...
} else if (out->useDrawChar()) {
  ...
  state->shift(tdx, tdy);
  ...
}

by : 

...
} else if (out->useDrawChar()) {
  ...
  if (wMode) { // vertical
    state->shift(0, tdy);
  } else { // horizontal
    state->shift(tdx, tdy);
  }
  ...
}

as you can see I have made my changes only in "if (out->useDrawChar()) {" statement.
perhaps it as to be done elsewhere too
Comment 2 Albert Astals Cid 2016-11-25 10:04:13 UTC
If you want us to consider your changes, please attach a patch file, don't write code as a comment.
Comment 3 GitLab Migration User 2018-08-21 10:42:43 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/339.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.