LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   RTF Editor like Wordpad on Ubuntu? (https://www.linuxquestions.org/questions/linux-software-2/rtf-editor-like-wordpad-on-ubuntu-4175612108/)

pan64 02-25-2022 11:16 AM

Quote:

Originally Posted by Reziac (Post 6333127)
But it's kinda irritating that we don't have a really good native RTF editor, which in turn would be natively suitable for low-resource systems.

see post #2 about it

DavidMcCann 02-25-2022 11:18 AM

Any word-processor should cope with RFT. I've just exported a file from Apache OpenOffice in RTF and reloaded it with no problems.

Reziac 02-25-2022 12:12 PM

Quote:

Originally Posted by DavidMcCann (Post 6333144)
Any word-processor should cope with RFT. I've just exported a file from Apache OpenOffice in RTF and reloaded it with no problems.

They can cope with it just fine. The problem is they bloat up the file and make a mess of the internal formatting. (Not to mention being too heavy for, say, my pinephone.)

Dedicated RTF editors don't add all the print layout codes that fullblown word processors do. Once that's in there, you have to find another tool to clean it out if you want to turn the file into, frex, a clean epub (free of weird formatting glitches, and not fighting with your chosen theme).

Or do a hand-edit cleanup, which is just loads of fun, tho has made me lots of money.

If you want to know how bad the bloat can get -- typically it's 2-3x the original, but I've seen LibreOffice crank a 500k RTF file into over 500mb, because it had made such a hash of its own added formatting. (This wasn't even a complex file; the only complicated part was Track Changes.)

Reziac 02-25-2022 12:21 PM

Quote:

Originally Posted by pan64 (Post 6333143)
see post #2 about it

Yeah, I think that's the real problem. Anti-Microsoft is a religion. But RTF is a completely interoperable open format with a published spec, what more do you want?

boughtonp 02-25-2022 04:46 PM


 
Delphi used to have an RTF component, so I wonder what the Open Source cross-platform Lazarus does in that respect...

A quick search suggests there is a port which might be good enough?

Quote:

Originally Posted by https://wiki.freepascal.org/lzRichEdit
Linux file reading is made by FPC TRTFParser class, with some changes to support images, this class is slower on complex files. Linux version supports only text formatting.

The download there includes a demo which might already be sufficient, but if not shouldn't take much effort to evolve into a basic RTF editor.


Reziac 02-25-2022 05:17 PM

Quote:

Originally Posted by boughtonp (Post 6333228)
Delphi used to have an RTF component, so I wonder what the Open Source cross-platform Lazarus does in that respect...

A quick search suggests there is a port which might be good enough?

The download there includes a demo which might already be sufficient, but if not shouldn't take much effort to evolve into a basic RTF editor.


The screenshot certainly looks good enough, but I downloaded the files and did not see any executable demo?

Not being a programmer (tho at times an interested bystander), I'd forgotten about Lazarus. Seems they win the award for the most cross-platform IDE ever. Thanks for the reminder; I have pascal source for an ancient (1991) DOS program I can't live without, and someday I'd like to see if it can be compiled in a more modern form.

boughtonp 02-25-2022 06:03 PM


 
Didn't mean to suggest it was pre-compiled - you'll need to install Lazarus and compile it to get the executable.


Reziac 02-25-2022 06:13 PM

Ah, okay, thanks. Been meaning to install Lazarus regardless! (But not today... busy...)

Should I achieve anything worth saving, I'll report back. More likely someone here will beat me to it. :)

vmelkon 02-25-2022 11:35 PM

Quote:

Originally Posted by Reziac (Post 6332902)
I don't understand how that works -- you mean something to recompile into KWrite?

That's a little beyond my present skillset... really cool that you can, tho :)

I looked at KWrite. It looks like Kate, which is sort of a basic text editor so I think that is not suitable.
I do remember using KWrite over 10 y ago.
It handles text highlighting, which is suitable for programmers but you won't be able to freely bold, underline, italicize, change font for each word or line.

Reziac 02-26-2022 12:45 AM

Quote:

Originally Posted by vmelkon (Post 6333294)
I looked at KWrite. It looks like Kate, which is sort of a basic text editor so I think that is not suitable.
I do remember using KWrite over 10 y ago.
It handles text highlighting, which is suitable for programmers but you won't be able to freely bold, underline, italicize, change font for each word or line.

To my understanding, Kate and KWrite are the same program under the hood.

Kate understands how to parse and highlight the formatting code in RTF (and a zillion other formats) but it only displays plain text.

I have no idea how hard it is to get from there to a WYSIWYG document display, but seems to me a lot of the guts are already there.

vmelkon 02-26-2022 01:01 PM

Quote:

Originally Posted by Reziac (Post 6333301)
To my understanding, Kate and KWrite are the same program under the hood.

Kate understands how to parse and highlight the formatting code in RTF (and a zillion other formats) but it only displays plain text.

I have no idea how hard it is to get from there to a WYSIWYG document display, but seems to me a lot of the guts are already there.

It's child's play.
Think in terms of low level programming.
If you want to render text, there are certain properties that you want to control:
1. The font
2. color
3. bold
4. italic
5. underline

Your code would look something like this
ChooseFont("Courrier");
setBold(true);
renderText_at_position_xy(0, 0, "bla bla bla");

You also need to keep data structures to know when to switch a properties.
You also need to know the line spacing needed. You use whatever API has to offer to get the text height.

I've writing a similar program to Kate, with text highlighting long ago, for Windows.
It was for writing OpenGL shaders.

But the guys of WINE have already written a Wordpad. Maybe they should compile a Linux native version.
https://appdb.winehq.org/objectManag...rsion&iId=1757

Reziac 02-26-2022 02:02 PM

Quote:

Originally Posted by vmelkon (Post 6333432)
It's child's play.
Think in terms of low level programming.
If you want to render text, there are certain properties that you want to control:
1. The font
2. color
3. bold
4. italic
5. underline

Your code would look something like this
ChooseFont("Courrier");
setBold(true);
renderText_at_position_xy(0, 0, "bla bla bla");

You also need to keep data structures to know when to switch a properties.
You also need to know the line spacing needed. You use whatever API has to offer to get the text height.

Thanks, now I understand how it's done, even tho I don't have the skills to do it.

I wish the source for my fave RTF editor was available (the program is abandoned).


All times are GMT -5. The time now is 01:36 PM.