How to optimize and accelerate your system (Sabayon)

Feb 07 2010

I made a post on Sabayon forums summarizing performace tweaks:

http://forum.sabayon.org/viewtopic.php?f=57&t=19762&p=112208&sid=112bbd1996b44132eb064c48c3a460e8#p112208

Update: Now it is in the Sabayon Wiki.

How to make Sabayon run faster

No responses yet

The Internet as an Operating System. Good idea, but …

Jan 24 2010

What does the OS run on? Typically IE or Firefox running on Windows. In this way, the Internet is the Information Highway for the privileged 20% of the world population with more than a billion computers in the global network. But wait a minute, did I say global network? What would happen if I cut off one node? In a true network, everything would continue to work unaffected. However, on the Information Highway, if the Chinese government banned Google, Chinese people would be using Bing. The network would continue to work unaffected. It’s still not a true network. What would happen if Bing is banned? Ok, a couple of nodes are lost, and China is in the dark ages. (We are in the Information Age now.) The point is illustrative enough. A true network functions with half its nodes lost.
What does the OS run on? Again, that’s the question. Coming up with the question is the hard part. The answer is easy: it runs on the network. What network? In terms of hardware, it’s the all the desktops, servers, microwave ovens, thermostats connected together, necessarily with ip addresses. In terms of software, it’s a neural network with arms and legs. Now, I’ve heard a secret. (Not you!)
Microsoft is working on this secret project, and the .Net Framework was designed to have the run time environment to support it. Bing Singularity to learn about what’s already been done.

PS: It sounds like I’ve just written a commercial for Microsoft

No responses yet

Fixing Fonts in Firefox for Linux

Jan 23 2010

I first noticed a font rendering problem when viewing some web pages in Firefox. There were two cases. The first case was easy to solve. The second case was specific to Firefox, and the fact that many people posted complaints online only made it harder to pinpoint the cause.
Let’s start with the easy one:

  1. Go to Tools -> Preferences -> Content
  2. Under Fonts & Colors, find Advanced
  3. Uncheck Allow pages to choose their own fonts
  4. Set fixed fonts:
  • Proportional: Sans Serif
  • Serif: DejaVu Serif
  • Sans-Serif: DejaVu Sans
  • Monospace: Luxi Mono
  • Minimum font size: 10

DejaVu should come by default with your Linux distribution, as it is an open source font project. Making the above changes will force sites like lifehacker that use Windows fonts to use Linux fonts. For more information, see Help for the Options window.

The second case was harder. I will go through the most common misconceptions first.
Mozilla does acknowledge there is a font problem on Unix platforms, and they have many solutions that did not fix the problem for me. At one point in the article, they suggested the problem was caused by a missing –enable-xft flag. For my system with fontconfig, the article declared, “xft labeled builds should produce clearly better results”. Now, I went about looking for builds with this flag, but it turns out this was a fallacy, too. My fontconfig file clearly affected font rendering on Firefox, as my test script showed. I was able to control the level of hinting at different pixels.
Ubuntu users also noticed this quirk with Firefox, although their fixes did not work for me. One user reported success with changing a Mac OS X setting on Linux. Another suggested a tweak “for advanced ligatures and smarter kerning”, not something I’ve heard of as far as font smoothing goes.
So enough with the fallacies, time to read articles posted by knowledgeable people (again). I mentioned in an earlier article what got me into this font business was a post I read back a while ago on Gentoo Linux. I still have its first edition in my email archives. So what was the problem, and how did I solve it? Firefox used the Cairo backend for rendering graphics. This was good as far as pretty vector graphics went. However, it turns out that Cairo is a poor choice for font rendering, as it needs to be patched to render bitmaps correctly for LCDs. Fixing the problem is easy on Gentoo:

  1. vim /etc/portage/package.use
  2. insert “x11-libs/cairo cleartype”
  3. emerge cairo

The next time I used Firefox, I noticed the discolored edges around fonts were gone! No more eye sore reading web pages!

No responses yet

Disable File System Access Timestamp

Jan 21 2010

Access time can slow down disk operations because it adds an extra write every time a file is accessed. This is most noticeable during boot when many files are read, and the access time located on another part of the disk is recorded. To turn off atime, just follow these steps
Windows: simply run “FSUTIL behavior set disablelastaccess 1” at the command line.
Linux: a few more steps are required, since the atime property is set per partition.

  1. vim /etc/fstab
  2. change defaults under mount options column to noatime

No responses yet

KDE Font Settings

Jan 16 2010

Besides editing the font configuration file, there is an easier way to adjust font settings on desktops like GNOME and KDE. This article will cover KDE, since I just read another article that tries to make Ubuntu look like Mac OS X.

  1. Menu > Computer > System Settings
  2. Under Look & Feel, Appearance
  3. Click Fonts > Configure
    snapshot2
  4. Make sure sub-pixel rendering is enabled if you have an LCD screen and Hinting style is set to the preferred level. Hinting affects the edge contrast of fonts.
    snapshot3
  5. Click Ok and Apply

No responses yet

Better Linux LCD Font Rendering

Jan 16 2010

After doing a font rendering comparison on Linux and Windows, I thought there was more that can be done in Linux. The script I wrote to display fonts at different pixel sizes helped to pin down the places where I noticed display artifacts. I notice font problems most often when browsing the web. A site like LifeHacker uses a font that’s not installed my Linux box. At other times, random colors appear on the edges of fonts at certain pixel sizes. However, the following font configuration file will make font on every page appear smooth if Firefox is configured to use system fonts. More on that in a later post.

/etc/fonts/local.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->
<fontconfig>

<!-- Use the Autohinter -->
<match target="pattern" >
    <edit mode="assign" name="autohint" >
        <bool>true</bool>
    </edit>
</match>

<!-- Disable Autohinting for bold fonts -->
    <match target="font">
        <test name="weight" compare="more"><const>medium</const></test>
        <edit name="autohint" mode="assign"><bool>false</bool></edit>
    </match>

<!-- Enable sub-pixel rendering -->
<!-- Uncomment this if you have an LCD screen -->
        <match target="font">
                <edit name="rgba" mode="assign"><const>rgb</const></edit>
        </match>

<!-- Font hinting to increase edge contrast -->
    <match target="font">
        <edit name="hinting" mode="assign"><bool>true</bool></edit>
        <edit name="hintstyle" mode="assign"><const>hintmedium</const></edit>
    </match>

<match target="font" >
    <edit mode="assign" name="antialias" >
        <bool>true</bool>
    </edit>
</match>

<!-- Exclude/Include a range of fonts for Anti Aliasing
    <match target="font">
        <test qual="any" name="size" compare="more"><double>8</double></test>
        <test qual="any" name="size" compare="less"><double>18</double></test>
        <edit name="antialias" mode="assign"><bool>true</bool></edit>
    </match>
-->

<!-- And/Or disable Anti Aliasing for a range on pixel-based size.
    Disabling this using both methods seems to fix Firefox.
    <match target="font">
        <test compare="less" name="pixelsize" qual="any"><double>20</double></test>
        <edit mode="assign" name="antialias"><bool>false</bool></edit>
    </match>
-->

<!-- Strong hinting for small fonts, increases sharpness.
    Enabling this seems to fix Firefox.-->
    <match target="font">
        <test compare="less" name="pixelsize" qual="any"><double>9</double></test>
        <edit mode="assign" name="hintstyle"><const>hintfull</const></edit>
    </match>


<!-- Light hinting for large fonts, reduces sharpness.
    Enabling this seems to fix Firefox.-->
    <match target="font">
        <test compare="more" name="pixelsize" qual="any"><double>13</double></test>
        <edit mode="assign" name="hintstyle"><const>hintslight</const></edit>
    </match>

<!-- Ignore any embedded bitmaps in TTF, etc (Microsoft's Calibri and others from Office 07/Vista have these) -->
        <match target="font" >
          <edit name="embeddedbitmap" mode="assign" >
            <bool>false</bool>
          </edit>
        </match>

</fontconfig>

After editing the file, a restart of your application is required for the settings to take effect (for me it was Firefox, since I was testing font configuration).

No responses yet

Extending Windows Explorer Preview Pane

Jan 02 2010

The preview pane in explorer doesn’t work for many files, and I’ve gotten used to seeing a preview of pdf and text files in the file manager in Linux. PDF-XChange Viewer has an explorer plugin and comes with some PDF editing tools. To make preview work with other text files like those with a php extension, there is a tool called PreviewConfig. Here’s what the previews look like:

Preview Pane in Windows 7

Preview Pane in Windows 7. Click on the area highlighted to activate.

PDF Preview

PDF Preview

No responses yet

Font Rendering Comparison

Dec 31 2009

After changing some font display settings in Linux, I wanted to test the changes. The specific change I wanted to test was the hinting level adjusted by pixel size. Hinting affects how sharp the edges of displayed fonts are. (Note that this is different from print appearance.) The article that got me started adjusting font display is a post on Planet Gentoo that I read a while ago. I noticed that there was a suggestion to use medium hinting to reduce fuzziness on small fonts. That was interesting, so I turned on full hinting for small fonts, hint medium for medium fonts, and hint slight for large fonts. You can see the result on the screenshot.

Linux

snapshot1

Medium hinting is set for pixel sizes between 7 and 11. As the size becomes larger, there are  noticeable color fringes on the edge of the fonts. That’s where hint slight comes in.

Now, there’s nothing fancy going on in Linux as all the settings can be changed in an XML file. So after adjust font in Linux, I decided to write a webpage to test the different pixel sizes.

<html>
<head>
<title>Font Rendering Test</title>
<style type = "text/css">
        .col1 {
            float:left;
            width:33%;
            margin-left:1px;
        }
        .col2 {
            float:left;
            width:33%;
            margin-left:1px;
        }
        .col3 {
            float:right;
            width:33%;
            margin-right:1px;
        }
</style>
</head>

<body>
<center>

<?php
$s = "";
for($i=97;$i<123;$i++){
    $s = $s . chr($i);
}

$font_families = array("Serif", "Sans-serif", "Monospace");
$n = 1;

foreach ($font_families as $font){
    echo "<div class="col" . $n . ""style="font-family:" . $font . "">\n";
    for($i=5;$i<22;$i++){
        echo "<p style="font-size:" . $i . "px">" . $i . " px</p>\n";
        echo "<p style="font-size:" . $i . "px">" . $s . "</p>\n";
    }
    echo "</div>\n";
    $n++;
}
?>
</center>
</html>
</body>
</html>

I happened to be using a computer running XP while I wrote this, so I decided to run the test on that computer, too.

XP

screenshot.1

XP, like Linux, does have color fringes, but they are less noticeable and appear at all font sizes.

Today, I booted Windows 7 to fill out a PDF form and print it across the network. I also planned to do some PDF editing using PDF X-Change Viewer. One thing that makes Windows different from Linux is that applications don’t have system-wide configuration file. PDF viewers have their own font rendering settings. Anyways, here’s what the fonts look like in Windows 7:

7

screenshot.1

Fonts in 7 does not have any rendering artifacts. Which is a reason people do notice the difference when they switch to another OS.

No responses yet

LCD Brightness in KDE4

Dec 28 2009

The KDE4 control panel does not have a panel for setting the display brightness yet. However, changing the display brightness can be done at the shell, and the changes take effect immediately.

  1. find a path like “/proc/acpi/video/VGA/LCD/brightness” using ls and cd (the exact path varies)
  2. cat yourfile. The top line contains possible values. The bottom line is the current one.
  3. login as root using su
  4. echo -n new brightness > /proc/acpi/video/VGA/LCD/brightness

to make this permanent every time you login, add it to the KDE autostart directory

  1. cd ~/.kde/Autostart
  2. vim set-brightness.sh
  3. put the following lines in it:

#! /bin/sh

echo -n brightness > /proc/acpi/video/VGA/LCD/brightness

  1. chmod 775 set-brightness.sh

No responses yet

Increasing mouse scroll speed in firefox

Dec 25 2009

This is easy in windows:

  1. hit start orb
  2. type mouse wheel
  3. hit first option
  4. set the mouse scroll rate

However, settings in Linux desktops such as GNOME and KDE does not directly set the scroll speed in Firefox:

  1. type about:config in Firefox address bar and hit enter
  2. make the following changes
  • mousewheel.withnokey.sysnumlines->”false”
  • mousewheel.withnokey.numlines -> 6 (default:3)

Scroll to see the changes

No responses yet

« Newer - Older »