I need to read a program in c/c++ in linux which shall read rtf file text and then informs me the information about the fonts properties of the text in rtf file. Can anyone tell me how to do that.. does any library exists for this that I may use.
Also can any one tell me that in linux which library is common or useful to work with fonts
Well RTF files are just HTML, only different.
That is, a text file which contains the presentation information as well as the content, in an easy (relatively speaking) text file.
Start by putting "rtf file format" in your favourite search engine.
here are a few utilities in bsd ports.
RTF is the Microsoft Richtext Format, a more portable, mostly-ASCII
formatting language that is exported by word processors like MS Word.
These files generally have the extension .rtf, but occassionally have
.doc extensions as well. This parser is from the Microsoft spec,
"ported" to Unix systems.
A simple rtf2html converter. If no file is specified rtf2html reads from
rtfx converts RTF files into a generic XML format. It majors on keeping
meta data like style names, etc... rather than every bit of formatting.
This makes it handy for converting RTF documents into a custom XML
format (using XSL or an additional processing step).
RTF features supported: page breaks, section breaks, style names,
lists (various types), tables, footnotes, info block, bold, italic,
underline, super/sub script, hidden text, strike out, text color, fonts.
Author: Nielsen <nielsen at memberwebs.com>
UnRTF is a command-line converter from RTF (Rich Text) to HTML, LaTeX,
PostScript, plain text, and text with VT100 codes. When converting to HTML, it
supports tables, fonts, embedded images, hyperlinks, paragraph alignment, and
more. All other conversions are "alpha" i.e. being newly developed.
rtf2LaTeX is a filter built on Paul DuBois' RTF reader that converts
RTF (Microsoft's Rich Text Format) into LaTeX.
rtf2LaTeX expends a good deal of effort in an attempt to make the resulting
LaTeX maintainable and modifiable.
Ok I understand now about the rich text stuff.
Now one more thing that I am feeling I need to know is about the Font Metrics. In windows we can get Font Metrics information through the device context object and other Win API functions.
But In Linux how can I get Font Metrics. Also the Font Metrics Attributes will be same or different on windows and Linux. I mean character size, spacing, height, width etc of the given font (say any ttf) will be same on both OS or there can be difference.
During searching I have found QFontMetrics class of QT library. I am reading it now but want to know if any body has used it before or may be familiar with this class may tell me if I am reading right class. Also there is a Free Type library .. any one know about this library. I havnt explored it yet but if someone know this library then I ask him to le me know if this is more suitable library to use for Font Metrics on Linux.
Also I need to know that does Linux have its own native API's for this purpose or it depends on these libraries.
Windows was designed as a 'do everything' GUI, so you automatically get things like GetFontMetrics().
X11 is an entirely different beast. I don't know of any standard libraries for stuff you want. If you are willing to use QT then I highly recommend it. It is a powerful system for this kind of stuff. I recommend you to the QT Online Reference Documentation. It is very complete and is chuck-full of examples.
Otherwise you are going to have to go pretty low-level.
Hope this helps.
Ok I understand what you are saying... I will try to focus on QT now and if I have any other ambiguity I ll come back here.