Find the answer to your Linux question:
Results 1 to 7 of 7
hi all I want to know that In windows MFC provides methods/classes to manage font in GUI forms like getting complete information about text size,font,colour etc., while we can use ...
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    12

    Question how to: get font properties of text in file using linux c/c++ ?

    hi all
    I want to know that In windows MFC provides methods/classes to manage font in GUI forms like getting complete information about text size,font,colour etc., while we can use win32 API for same purpose in windows console(DOS). But what is the story of fonts in linux. can i write a program which can read a file and tells its font information. say I want read a document file which has text in different size,font and color. how shall I read this file using C/C++ and get all the information about the text properties in this file. will i have to use any 3rd party library for this purpose or linux provides library for this. Also I am talking about simple C/C++ program that may run from the terminal.
    One another question can I print text on terminal(bash) such that the text has different size, font and color. if yes then how. I need answers and hints from the linux geeks and programming gurus.
    Regards

  2. #2
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422
    Well, it depents on what graphical library you want to depent the user to have.
    if you want it to become a 'Dos' like with menus. You might want to use ncurses
    If you want it gnome like use GTK if you want it KDE like use QT. If you want it....
    Lots of librarys give you this function.

    Hope that helps.
    New Users, please read this..
    Google first, then ask..

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Posts
    12
    if I have a simple file in linux say rtf file and I want to extract text and font properties in that file..then which library shall I use. Or there exists a common library for this purpose. I have a code in windows which uses MFC and Windows API to get information about fonts of the text from rtf files and other files. But now I need to port the application to linux and hence I have to understand this. I will try to use QT as proposed here but just wanted to know that if any GNU Linux library exists. Also does this mean that I cannot display text on terminal in different font?.
    One more query... During searching at web I have encountered freetype a platform independent library, can anyone tell me that for what purpose this library is useful.

  4. #4
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422
    Ah, ok well I kinda misunderstood you there.
    I thought you wanted to write on a screen with diffrent Fonts.

    Well for this you need to know the FileStucture. ( Rich Text Format (RTF) Version 1.5 Specification )

    Then you can just read the file. ^^

    Hope that helps.
    New Users, please read this..
    Google first, then ask..

  5. #5
    Just Joined!
    Join Date
    Nov 2007
    Posts
    12

    Unhappy

    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.

  6. #6
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Well for this you need to know the FileStucture. ( Rich Text Format (RTF) Version 1.5 Specification )

    Then you can just read the file.
    Ok I understand now about the rich text stuff.
    You can save yourself a lot of work by downloading librtf.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  7. #7
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422
    Whoops, Sorry I didnt know about that library.
    Atleast you learned how RTF files work now
    New Users, please read this..
    Google first, then ask..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...