Wednesday, 19 November 2008

GoogleEarth 4.3: How to change the GUI fontsize in Linux

Just installed GoogleEarth version 4.3 on my CentOS 5.2 machine today.

The installation finished without any errors but the font the GUI started with was a complete disaster. It was so small I could not read it. A little bit of googling revealed the following:

  1. GoogleEarth 4.3 stores it's configuration in the ~/.config/Google directory.
  2. Inside it, the file GoogleEarthPlus.conf contains a section called [Render].
  3. The render section contains attributes for GuiFontFamily and GuiFontSize. Place the right values over there, restart googleearth and that does it.

Thanks to Santana for posting it.

Tuesday, 11 November 2008

JavaScript: Dynamically changing CSS properties of any DOM object

I was trying to create a web album the other day and played around with the gThumb image program. The program offers various templates that allow you to create web galleries with various different styles and it turned out that for me, the BestFit template was the best looking of them all.

The interesting part of the story is that when you create a web gallery based on the BestFit template, you also get a number of JavaScript files containing various programming goodies like the get and set property functions that I am displaying on this post. The copyright of these functions is Copyright (C) 2005-2006 Free Software Foundation, Inc., thus my thanks here go to Rennie deGraaf who provided both the template and the opportunity to get access to these functions.

So changing the width, height, or display mode of any DOM object found in your web page has never been so simple.

// set a property to a given value on an object
function setProperty ( obj, prop, val )
    if ( // W3C, val, null);
    else // MSIE
        eval("" + prop + " = \"" + val + "\"");
// gets a style property for an object
function getProperty ( obj, prop )
    if (document.defaultView && 
        document.defaultView.getComputedStyle) {
        var val = document.defaultView.getComputedStyle( obj, 
        if (val)
            return val;
            return eval("document.defaultView.getComputedStyle(obj,null)." + prop);
    else if (window.getComputedStyle) // Konqueror
        return window.getComputedStyle(obj,null).getPropertyValue(prop);
    else if (obj.currentStyle)        // MSIE
        return eval('obj.currentStyle.' + prop);