Saturday, September 13, 2014 - 19:08

Here's a little BASH script that takes a font as a command line argument and generates the webfonts necessary to use @font-face CSS rules:


# genwebfonts.sh

# The MIT License (MIT)

# Copyright (c) 2014 Ruben Rodriguez (cha0s)

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

filepath=$1
filebase="${filepath%.*}"

for ext in eot ttf woff; do
    
    outfile="${filebase}.${ext}"
    if [ ! -e "${outfile}" ]; then

        fontforge -lang=ff -c 'Open($1); Generate($2)' $filepath $outfile
    fi
done

Example usage:


$ ls
genwebfonts.sh  Komoda.ttf
$ ./genwebfonts.sh Komoda.ttf 
$ ls
genwebfonts.sh  Komoda.afm  Komoda.eot  Komoda.ttf  Komoda.woff
Monday, June 23, 2014 - 01:34

Well, if I'm going to complain about it, I'd better put my money where my mouth is, huh? Good thing that's how I roll. :)

If you're looking to concatenate binary files using grunt-contrib-concat, go check out/support my pull request: https://github.com/gruntjs/grunt-contrib-concat/pull/86/files

Instead of assuming we're using strings, it now uses buffers and direct file reading/writing. I needed this while working on the distribution system for my upcoming game engine. You can check it out at avocado-baseline if you're interested! It's still early, but with a little skill you can already get it working and have pretty pictures dancing around on your liquid crystals. ;)

Peace~

Monday, June 23, 2014 - 01:28

Hey y'all <3

In the process of migrating Avocado to being node-webkit capable, I've been discovering some issues in JavaScript libraries assuming that window is the top-level global. In node-webkit this is not always the case.

Most people writing JavaScript will, for instance, use document or Image or a number of other attributes of the window object, without qualification (e.g. window.document). As I mentioned, in node-webkit there is not a guaranteed top-level window global, so this becomes problematic! So this was pull request #1 for Buzz.

The second pull request was a little more interesting! I noticed while doing some tests that Buzz can't really loop music seamlessly. This seems to be a tricky problem in general, as I have read mailing lists of people lamenting the inability for most modern browsers to bridge this gap. This is sad for anyone interested in creating interactive web experiences with high production values. What a flowery way of saying a game! ;)

The second pull request routes all audio through the shiny new HTML5 web audio API. This drastically improves performance on Chrome, though I noticed that Firefox still seems to have trouble keeping up. To be fair, I am not an expert on the web audio API. It's really new! I'm going to continue studying this problem and see what I can come up with, but for the meantime things are looking a lot better in Chrome! Go visit the pull request and support/improve it!

Peace~

Saturday, May 24, 2014 - 13:48

I added my key to ~/.ssh/authorized_keys, so why isn't it working?!

Apparently authorized_keys has to have the correct permissions (0600) before sshd will acknowledge it exists. TIL!

Thursday, May 22, 2014 - 20:04

I noticed that when I would get a UAC permission prompt on my Windows synergy client, I was disconnected from the desktop for about 5 seconds. During that time I was unable to use my mouse or keyboard on that desktop until the client reconnected.

I found an issue here: http://synergy-project.org/spit/issues/details/3311/ which is the same issue, reported back in July 2012! There is a simple patch, so I applied it (after struggling to get a working compilation environment on all hackers' favorite OS, of course), tested, and it works!

I am maintaining an unofficial synergy mirror on github: https://github.com/cha0s/synergy-unofficial oh, and the specific fix outlined here is on its own feature branch: https://github.com/cha0s/synergy-unofficial/tree/fix-3311-uac-disconnect. Now, to fix the fact that copying in Windows won't paste into my Linux... :)

I also built an x86 (sorry, x64 was beyond my tolerance for MSBS) installer with the fix included, you can download that here: http://www.cha0s.io/sites/default/files/synergy-1.4.19-Windows-x86.msi and obviously, if you don't trust me you can use the github branch above. No hard feelings.

Wednesday, May 21, 2014 - 22:19

I'm always sad about not having a blog because I do so many interesting (well, to me anyway) things and I never write about them. Well, what a better time than now?

Subscribe to Front page feed