issue-#182 fixing code page conversion in RTF import

Re: issue-#182 fixing code page conversion in RTF import

Postby Robert » Tue Dec 05, 2017 10:12 am

luowy wrote:and I want to know, which version of RTF standard do you use?

I did some work on RTF conversion in early 2006. A brief quote from my notes written at the time:
The main references used were the 1.6 & 1.7 specifications. Some topics are better explained in one version; some in the other.
User avatar
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#182 fixing code page conversion in RTF import

Postby Robert » Tue Dec 05, 2017 10:36 am

Robert wrote:I did some work on RTF conversion in early 2006. A brief quote from my notes written at the time:

I attach my full 2006 notes below.
1 - There has been some discussion about paragraph formatting. My note # 8 discusses this topic, and might have some value. Much experimentation led me to the conclusion that there was not a simple way to preserve paragraph formatting between BlackBox, Word, Wordpad and Open Office. The problems varied with different versions of these programs.
2 - My note # 11 also might have some value. It adds a debug mode, and is simple to implement.
3 - The only other interesting aspect of this 2006 / 2010 version of RtfConv is support for arbitrary Views as bitmaps. I would like to see this added to the Centre version (AFTER version 1.7.1 !), and then I would remove CasketRtfConv which is otherwise obsolete.

(As an aside I no longer have any personal use for, or interest in, RTF files!)

CasketRtfConv.pdf
RTF Conversion note, 2006 & 2010
(70.38 KiB) Downloaded 116 times
User avatar
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#182 fixing code page conversion in RTF import

Postby Josef Templ » Tue Dec 05, 2017 12:53 pm

Zinn wrote:
Josef Templ wrote:I have also added the fix that the default font is used when a non-existing font is selected.
- Josef


IF (f = NIL) & (i # defFont) THEN font := Font(defFont) END;
ASSERT(f # NIL, 100);

The IF line doesn't help. It traps anyway, because f is still NIL.
Deleting the ASSERT statement doesn't help either, because then it traps later at the Attr statement.
- Helmut


Sorry, I introduced a trivial typo when taking over changes from one PC to another.
It must be f := Font(defFont).

(This shows the danger of nested scopes, BTW.)

Anyway, I took the opportunity to look into the "fonts" initialization and made some cleanups related to
the default font handling. The refined strategy is to mark the first entry with a special id (noFontId; previously it was 0) to signal that
it is not defined in the RTF font table. This is the default font being used in case of selecting an undefined font.
It ALWAYS exists and if it is not used for any text but only selected for some strange reason (as in LibreOffice)
it doesn't matter at all which font is selected as long as it does not trap.

See the diffs at https://redmine.blackboxframework.org/projects/blackbox/repository/diff?utf8=%E2%9C%93&rev=aa34f96b28a8f67b3f5f5b6aade655375f7b698a&rev_to=fd4e51502b2980c1f055e39fbe0a0642cc0071cd

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#182 fixing code page conversion in RTF import

Postby Josef Templ » Tue Dec 05, 2017 2:05 pm

Robert wrote:
Robert wrote:I did some work on RTF conversion in early 2006. A brief quote from my notes written at the time:

I attach my full 2006 notes below.
1 - There has been some discussion about paragraph formatting. My note # 8 discusses this topic, and might have some value. Much experimentation led me to the conclusion that there was not a simple way to preserve paragraph formatting between BlackBox, Word, Wordpad and Open Office. The problems varied with different versions of these programs.
2 - My note # 11 also might have some value. It adds a debug mode, and is simple to implement.
3 - The only other interesting aspect of this 2006 / 2010 version of RtfConv is support for arbitrary Views as bitmaps. I would like to see this added to the Centre version (AFTER version 1.7.1 !), and then I would remove CasketRtfConv which is otherwise obsolete.

(As an aside I no longer have any personal use for, or interest in, RTF files!)

CasketRtfConv.pdf


Most of the points are already resolved.
The remaining points are quite intricate and may be subject for 1.7.2.
Correctly skipping \bin, for example is surprisingly difficult because it can destroy the
nesting with { } and it can terminate the input with 0X.
Simple cases of \bin are already skipped but \bin can also occur in a skipped part (following \*)
and then it gets complicated.

There have been a number of improvements for 1.7.1, actually more than originally intended
(support for all far eastern languages, for example).

With the latest fixes I think (hope) we have reached a point where we can proudly stop for 1.7.1.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#182 fixing code page conversion in RTF import

Postby Zinn » Tue Dec 05, 2017 8:30 pm

Josef Templ wrote:With the latest fixes I think (hope) we have reached a point where we can proudly stop for 1.7.1.

I'm agree. The result is much better as with the version 1.7 from the last year. We should stop now.
- Helmut
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Previous

Return to Resolved (Bugs)

Who is online

Users browsing this forum: No registered users and 1 guest

cron