Archive for mars, 2010

ecofont in LaTeX

Dimanche, mars 7th, 2010

Introduction

ecofont is a TrueType font developed by the netherlandees (more specificly by Spranq). Its aim’s to reduce the ink usage when documents are printed while maintaining the same readibility as the original font. After trying several concepts, they “deduced” that putting little holes inside the fonts does the trick. Now we’ve got a ttf file, which can be used considerably easily in some OS-es and maybe in OpenOffice, but gives a headache under LaTeX.

LaTeX and ttf

The main problem with tutorials on how to put the ecofont (or a ttf font) in LaTeX is, that they all begin with

ttf2afm -o ecofont.afm ecofont.ttf

and  this gives a segmentation fault. When debbugging the code (and I did that) you discover, that the problem is in the format. ecofont references some table, which it does not contain and this gives ttf2afm a deadly stab.

fontforge

I understand people’s passion to develop fonts. But after a short while, you discover two things:

  1. That drawing the 26 letters of the english alphabet is not enough
  2. if you only redraw some letters, than your font will be inconsistent and inevitably ugly.

Maybe that’s why, when you run up fontforge (which appears to be an excellent font editor), you have a nostalgic feeling of DOS times. I ever wondered how difficult would it be to update the gui to qt? Anyhow, in the matters of engine, there is no missing feature, so you can export the ecofont.ttf to PostScript type 1 including all the neccessary complement files. In the end you create two more files:

 t1ecofont.fd

\ProvidesFile{t1ecofont.fd}[ecofont]
\DeclareFontFamily{T1}{ecofont}{}
\DeclareFontShape{T1}{ecofont}{m}{n}{ <-> ecofont }{}

ttfonts.map

ecofont ecofont.ttf Encoding=ecofont.enc

and you’re done. My solution is here, so if you just want to use ecofont in LaTeX, download it and look at the example.

Caution

I am not convinced about the environment-friendliness of ecofont. Depending on where you read it they claim about 15-20% of ink save. The idea behind the design is, that if you have smaller surface, you save ink. Do you have smaller surface? It depends compared to what. If you compare ecofont to itself you may have this ratio, but if you compare it to the LaTeX standard cms font, you inevitably notice, that ecofont is considerably thicker. Also the default 10pt size, which is set up in LaTeX is considerably bigger (this is a subjective notice). Now I set the ecofont to 8pt in the example. At this size, the letters seem to be the same size az the standats LaTeX font (though the cms still seems a little more thin at some placeses). Furthermore, you have the pixel thin sans sherif fonts (fonts without a practical thickness), but these may be bigger to achieve the same redibility.

Conclusion

You can use ecofont in LaTeX, and it’s quite easy, once you have the necessary files generated. To determine the objective truth, wheather it’s worth it to use ecofont, the letter surface should be calculated, but this is beyond my interest in the matter.

External Links:

ecofont

ecofont on wikipedia

fontforge

VirtualBox OSE - with rdp server or without?

Mercredi, mars 3rd, 2010

VirtualBox is an incredibly useful virtualization tool. Here are the possible uses of virtualization that may interest you:

  • You’re company and you have to use some old software with no recent os compatibility (for example old DOS accounting software)
  • You want to set up several web-servers on the same machine and you want to give the administrators unlimited access over their own server but no access to the others.
  • You’re a teacher who teaches linux programming and you want your students to practice at home, but they don’t have linux on their machines.
  • You’re an os-geek, who wants to try out tons of OS-es, but don’t want to reinstall everything
  • You’re favorite os does not support you’re new hardware
  • You just want to have fun with virtual machines.

As you are looking at the feature list of VirtualBox you can see, that most of it is free software, but there are two features particularly useful for corporate users, which are binary-only. These are the RDP support and the USB support. In this essay I am going to talk about the built-in RDP server and the possible improvements and workarounds.

RDP-in-depth

First of all I want to waste a few words on what is RDP. Well with the advancement of local network and Internet,  more and more computers are accessible from distance. The classical very fledged method of accessing them is SSH. SSH, on the contrary of that some may believe, DOES support graphical access, but (by default)  it lacks the possibility of accessing the Desktop as you would see it from the display next to the iron. Also somewhat out of my consern, but SSH cannot access not unix-like os-s. To overcome these limitation RDP protocol has been designed, to allow remote graphical access to your computer. It is well supported on regular unixes and other os-es as well. The model is simple, you give your username, password and you get the same screen as you would have sitting in the computer room.

What has RDP to do with VirtualBox?

A regular home enthusiast may have some problem with understanding, what is the interest in RDP for VirtualBox. To see this you have to imagine a 16-core machine with lots of capacity. These machines even nowadays are to be used by many people. These people sometimes need regular os-es to do they work. The reason for this lies in the much hate-able  binary-only software. Imagine, that ten years ago your company bought an accounting software or a stacking software. It has been working for ten years and they’d put all their company history in it. They would like to keep that history, but that was a ten years old operating system which you can’t even install on a normal computer. What do you do? You virtualize. So you put together a virtual machine, and you install it on the server. To access this machine VirtualBox offers you an RDP connection. This means, you access it from home. This is convenient.

Slow internet? Nomachine can help.

One of the inconveniences of RDP is, that the compression it uses is bad. If you have a regular connection to you’re computer through one or two corporate proxy’s you might find it almost unusable. What can you do about that. The answer comes from the movie file formats. Now for more than a decade (since the uprise of the DVD-s) companies have put uncountable working hours in video compression.  If you realize that a distant screen is essentially a movie, the answer is right there. Most fortunately for us, there is a company specializing in remote access WITH lossy compression. They achieve higher compression rates and thus lower bandwidth need than traditional RDP … and they solution is also free.The software is called Nomachine.

Connecting Nomachine and VirtualBox - first approach

I will not give here a detailed tutorial, because there are lots of tutorials on the Internet of how to configure a virtual machine with an RDP server on it. You needn’t look further than the VBox manual. Once you’ve finished the configuration of both systems and you run up nomachine, here’s the line in the configuration file yo have to change

/usr/NX/etc/node.cfg

CommandStartKDE = “rdesktop localhost:1525″

Supposing of course, that you’ve configured the virtual machine on port 1525. If you connect now with Nomachine and set up the session with KDE, you’re going to access the virtual machine, instead of a new session. This screen will be nomachine-compressed thus much faster on slow connections. If you have a good network access it may still serve because nomachine’s much reliable authentication.

Connecting Nomachine and VirtualBox - the ultimate free software solution

You can say, OK this solution works, but hey if I use the rdp front-end I’m still stuck with the proprietary version of VirtualBox. You are right, but you can enhance this schema even further to only use the capabilites of VirtualBox OSE. You can transport any graphical interface with Nomachine, so you can in theory transport the

VBoxManage startvm ‘MyMachine’ –type sdl

command. The only inconvenience is, that the command quits as soon as the machine is started so you need to wrap it with a shell-script that you keep alive. The example is like this:

#! /bin/bash
# UjoImro, 2010
# starts the virtual machine and never quits so we can use it with nomachine.

VBoxManage startvm ‘MyMachine’ –type sdl

while [ 1==1 ]; do date; sleep 10; done

# LuM end of file

and you set up in the node.cfg:

CommandStartKDE = “/path/to/my/script.sh”

Thats it. A complete enhanced free VirtualBox with remote access capability. The only inconvenience of this method, that it needs an X system and the qt libraries installed on the server machine, thus having more dependencies than VBoxHeadless.

Further improvements - authentication

When you access the server, you are authenticated by nomachine. This is already a good start, but if you have many users, it might not be enough. In the script however you can access the username with the `whoami` command, and you can make further choices according to that. A deeper authentication is also possible, but there is no general schema, because it can depend very much on your particular needs.

Conclusion

VirtualBox is a great free software tool. As you can see from the above example the enhanced features are only for collecting some money from companies/professional users. This solution can be useful for those, who need better compression/lower bandwidth or for those, who insist on free software.

External links

All the above methods where tried on the following software.