Rendering Unicode with Anti-Grain Geometry

(In the image, the boxes are certain special Unicode characters. The first box is the BOM (byte-order-mark) and the last one is just a control character. A test character (the ら) precedes the ones from file, which is why the BOM isn’t first.)

After figuring out how to render vector graphics onto Irrlicht IImages using AGG, I wanted to utilize the font system of AGG. Admittedly, using FreeType directly would probably have been better, but FreeType doesn’t provide any mechanisms for rendering onto our surface, and AGG does.

Continue reading

Advertisements

How to Color Your Terminal Text in a C++ Program

A quick internet search will show you how to do this in Bash, but what about for a C++ program? If you want to color the text of stdout, it would make sense to directly write to it. Notably, Bash text coloring requires calling “printf”. That’s your first hint.

It turns out that, if you inline these color codes, you can print them out directly from printf inside your C++ program. Of course, you’re limited to setting one parameter at a time.

Example:

printf("\33[31m I'm red text!\33[0m I'm reset-color text. \33[4m I'm underlined text!\33[0m")

You can do a number of things (like underlining your text, setting the background color of your text, etc) depending on the SGR codes (scroll down the page to see them), but you’ll have to reset them with \33[0m if you want them to stop.

The graphic application applies to all text in the range except for tabs. I guess tabs don’t count as text. Spaces still work though, so if you want a blank area with a background color, use text for the spaces.

Predictions: Pads for the Tactile

Imagine this: You’re on your mobile device having a video call with family a long ways away. Your sibling raises the family pet up to the screen. With the flip of a setting, you turn on “Tactile Mode” for your device and proceed to wave your hand over the screen of the device. Small electrical signals come up from the screen and tingle your hand like the fur of your pet on the other end of the net.

Continue reading

Rendering Anti-Grain Vector Graphics in Irrlicht

Anti-Grain is a C++ vector graphics library. Irrlicht is a C++ game engine, though it’s also used for generic applications. Both of them are very quick to setup, but while Irrlicht is rather simple to understand, Anti-Grain takes quite a bit of time studying the code. It just so happens the two of them go hand-in-hand very well together due to each one’s flexibility. And best of all, it’s really easy to integrate them. Allow me to show you.

Continue reading

Reinventing the Internet – Intro

Like many geeks, I have lots of ideas about how the internet should be reinvented. What’s wrong with it? Lots of things. I’d like to start off with the mess that goes on behind the scenes. This is of more interest to web application developers. Then I’ll move on and talk about what will interest the average netizen: the “new browser”.

Continue reading