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.
Hi guys, need some advice here. I need to display some text on the screen (code actually).
However I need to add support for zooming. For example, I want to be able to zoom in on a particular area, and similarly to zoom out so that I can see all/most of the code at once.
The code will be colour-coded (hmmm) so let's say that some lines will be black and others, red.
One method I was thinking of was when zooming out, simply draw a line on the screen representing a line of code (either black or red). Then by clicking on it I can zoom in. Would this work? Can you all give me a better/alternative approach?
render the code to large bitmap, then scale the bitmap to the appropriate size and draw. i have no X11 programming experience but i could knock up a win32 example if it would help.
I suppose you'd need to find a way to display text in a different size; I have no idea how you could do that without using graphics Usually the console font is fixed according to the VGA mode you're running in; fonts in a terminal window cannot, as far as I know, be manipulated by a programming running in the terminal window.
You could do it with ASCII art, I guess
ZOOM
Code:
ZZZZ OO OO M M
Z O O O O MMMMM
Z O O O O M M M
ZZZZ OO OO M M M
i assumned you wanted to do this in X, so as i said all you would need to do was render the text to a bitmap then scale appropriatly and draw. but if your trying to do it in a console then ive no idea how to do it, as wapcaplet said i dont think its possible without using graphics.
just had an idea for doing it on console - do as i say above render the text to a bitmap, scale it, then draw it with aalib. results wont look amazing but i think theyed be pretty good.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.