From Rasmus Hansen, dynastit@hotmail.com /
http://www.mooco.org
First suggested solution wasn't complete. This is better
(does closing of bold tag when italics state is changing).
It's not really a proper general solution though. A better
solution would probably keep a stack of open tags.
*** HtmlOutputDev.cc.orig Thu Oct 6 14:38:55
2005
--- HtmlOutputDev.cc Wed Oct 19 12:41:23 2005
***************
*** 492,503 ****
/* fix <i> and <b> if str1 and str2 differ */
! if( hfont1->isBold() && !hfont2->isBold() )
str1->htext->append("</b>", 4);
! if( hfont1->isItalic() && !hfont2->isItalic() )
str1->htext->append("</i>", 4);
- if( !hfont1->isBold() && hfont2->isBold() )
- str1->htext->append("<b>", 3);
if( !hfont1->isItalic() && hfont2->isItalic() )
str1->htext->append("<i>", 3);
/* now handle switch of links */
--- 492,506 ----
/* fix <i> and <b> if str1 and str2 differ */
! /* in order to preserve right order of tags it
may be necessary to close and reopen the bold tag */
! bool pauseBold = (hfont1->isBold() &&
hfont2->isBold() && // bold is carried thru
!
(hfont1->isItalic() != hfont2->isItalic()));
// italics changes state
! if( pauseBold || (hfont1->isBold() && !hfont2-
>isBold()) )
str1->htext->append("</b>", 4);
! if( hfont1->isItalic() && !hfont2->isItalic() )
str1->htext->append("</i>", 4);
if( !hfont1->isItalic() && hfont2->isItalic() )
str1->htext->append("<i>", 3);
+ if( pauseBold || (!hfont1->isBold() && hfont2-
>isBold()) )
+ str1->htext->append("<b>", 3);
/* now handle switch of links */
Logged In: YES
user_id=1305086
I have created a prototype of a tag stack in Ruby and will
be porting it to C++ over the next week or so and will
submit a tarball of my pdftohtml when I have finished the
changeover.
BTW, I tested my prototype against all permutations (order
matters) of the a, b, and i tags (16 total) crossed with all
8 combinations of a, b, and i tags (since order doesn't
matter in the properties of the next HTMLText element to be
joined).
7/21/06