ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Do you have any recommendations on fonts to use while programming. I use the vim editor and it defaults to sans. What about courier? What about a proportional width font like times or arial?
Note: I know how to change the fonts, I want to know what some experienced programmers think is the better fonts - at least as far as such a subjective opinion can be recommended.
Stick with a monospace font. Things tend to line up better that way.
Beyond that, it's a matter of taste. I'm not even aware of which font I'm using, as long as it's monospace.
I did an experiment with fonts used for source code in OpenOffice. I opted to use OpenOffice because it is much easier to switch fonts much more rapidly in OpenOffice - and since this was an experiment with the displays of fonts this seemed the best environment. I found that proportional width serif fonts, while perhaps slightly easier to read don't line up the text at all so any benefits gained by the serifs are lost by the inconsistency of placement and alignment. Fancy fonts (i.e., Old English, Monotype Corsiva, etc.) are extremely hard to read with source code, to the point of being absolutely illegible. The best were the monospaced fonts.
The winners are (note: these are only fonts on my system - and only those that are read by OpenOffice - and not every font in the world):
Courier
Courier 10 Pitch
Courier New
DejaVu Sans Mono
Bitstream Vera Sans Mono
hi
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
Your document wouldn't be a text file then because it would have embedded font information, unless you are creating a document with markup information. Maybe you should start with what kind of document you want. rtf, xml, html???
Ok so this means that I cannot write text with different fonts to the terminal. But if I want to change size of the text in output to terminal can I do that or that is not possible either.
For reading text file you can help me to read rtf files. If I need to read rtf file in linux and get text font properties from that rtf document then how shall I write a c/c++ program for that
Regards
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.