Blog

Medieval font support on Android

Cyrillic post-it noteFroyo 2.2 brought native Arabic, Hebrew and Thai support to Android, but what about Glagolitic? What is a Slavic medievalist to do without the Old Church Slavonic combining characters, or any of the other wonderful characters introduced in Unicode 5.1? No longer content to look at rectangles, I set about installing a font that supported the Unicode characters I count on.

What you need

  • A rooted Froyo phone. Not rooted? Check out Unrevoked or Universal Androot.
  • The Terminal Emulator app by Jack Palevich, available in the Market (NOT the one by ZTA Technologies)
  • A font that supports your favorite Unicode characters
  • A computer

The procedure

  • Connect your Android to the computer, and copy the font to the root of the SD card on your Android. Rename it DroidSansFallback.ttf (the capitalization is important)
  • Unmount and/or disconnect your Android from the computer
  • Launch Terminal Emulator
  • Type su. A "Superuser request" screen might come up; allow access. You'll know it works when the prompt in Terminal Emulator changes from $ to #
  • Type mount, and your screen will be filled with a lot of text. Look about 9 lines down for one that looks like /dev/block/mtdblock[some number] /system yaffs2 ro,relatime 0 0. On my Evo 4G, this line says /dev/block/mtdblock4 /system, but different phones have a different number after mtdblock. Make a note of yours.
  • Glagolitic on an AndroidType mount -o rw,remount -t yaffs2 /dev/block/mtdblock4 /system, substituting in the number you just wrote down instead of "4", if yours is different.
    • A helpful hint: At least on my setup, using SwiftKey and Terminal Emulator, you can't type a period or comma without overwriting the previous character. If you have this problem too, type a space before typing the comma (i.e., in rw,remount). It'll replace the space with the comma and you can continue as usual. This also comes in handy when you need to type the period in DroidSansFallback.ttf.
  • Type cp /system/fonts/DroidSansFallback.ttf /sdcard/DroidSansFallbackOld.ttf. This will copy the built-in DroidSansFallback.ttf font to your SD card with the name "DroidSansFallbackOld.ttf". That way, if you ever want to restore the default font, you'll still have it.
  • Type cp /sdcard/DroidSansFallback.ttf /system/fonts/DroidSansFallback.ttf. This will overwrite the default DroidSansFallback.ttf font with the font you've chosen.
  • Reboot your phone, and savor the joys of Unicode.

Tags: 

Installing Cocoon on Ubuntu 10.04 or 10.10

This is an updated version of a how-to written for Intrepid (8.10), now horrendously out-of-date. It was written for Maverick (10.10) but should also work on Lucid (10.04).

No knowledge of Ubuntu or Linux is assumed; the intended audience is someone who's managed to install Ubuntu and isn't too intimidated by the Terminal. (Hint: You can copy and paste, but in Terminal, pasting is Ctrl + Shift +C)

Step 1: Installing Java SDK

(Thanks to Daniel Bruegge for the tip)

  • Open the Terminal (Applications > Accessories > Terminal)
  • On Maverick: type:
    sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"
  • On Lucid: type:
    sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
  • Type:
    sudo apt-get update

    This will check all the software repositories for what updates are available, including java.

  • Type:
    sudo apt-get install sun-java6-jdk

    It will ask you if you want to continue; type y to confirm.

  • You'll have to agree to the TOS and license (you can use the tab key to move between the options) and then it'll install on its own.

Step 2: Installing Maven

  • Open Terminal, and type
    sudo apt-get install maven2

    This will list all the packages that need to be installed; type y to proceed

Step 3: Installing Cocoon

  • Open the Terminal and type
    mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org
  • This begins the install process.
    • For archetype, choose 2
    • Define value for groupId: - This should be a unique value. A classic value to use is, if you own the namespace myurl.com, you could type com.myurl
    • Define value for artifactId: cocoon
    • Define value for version: 1.0-SNAPSHOT: 1.0.0
    • Define value for package: - groupID.cocoon (i.e. com.myurl.cocoon)
    • Confirm the properties
  • After everything's done installing, you should see [INFO] BUILD SUCCESSFUL

Cocoon will install in your Home folder, in a folder named the same thing as whatever you put for your artifactID. Here, the folder is named cocoon.

Step 4: Starting Jetty

You need to make a configuration change in the Maven settings.xml to be able to run Jetty. (Thanks to Ganesh Gembali for the tip.)

  • Open up Terminal and type
    sudo gedit /etc/maven2/settings.xml
  • This will pop up a text editor with settings.xml. Search for pluginGroups, and between
    and , add
    org.mortbay.jetty
  • Make sure you're in your cocoon directory in Terminal (does it say ~/cocoon$ right before the cursor?), and type
    mvn jetty:run
  • There'll be a lot more installing, but it should conclude with [INFO] Started Jetty Server
  • Open a browser and go to http://localhost:8888/cocoon - you should see a message saying Apache Cocoon: Welcome

Step 5: Cocoon Add-ons

There are a couple add-ons for Cocoon that are essentials-- like generators for HTML. If you want to use XSLT 2.0, Saxon 9 is also critical. Possibly less important are the FOP processor (to generate PDFs from XSL-FO), Batik (for SVG) and Forms (to genrate forms). If you don't need to use XSLT 2.0, you can skip the first part of this section.

  • Installing Saxon 9 - a good idea
    • Open your cocoon directory and navigate to src/main/resources/META-INF/cocoon
    • Create directory avalon
    • Create the following files in Text Editor (Applications > Accessories > Text Editor), and place them in the avalon directory:
      • File named cocoon-core-xslt-saxon.xconf
      • File named sitemap-transformers-saxon-transformer.xconf
        saxon
    • Download Saxon-HE 9.2 for Java. By default, this will go into your Downloads folder.
    • Extract the zip file; you can delete everything but saxon9he.jar
    • Open a new Terminal
      cd cocoon
      mvn install:install-file -DgroupId=net.sf.saxon -DartifactId=saxon -Dversion=9.2.1.2 -Dpackaging=jar -Dfile=../Downloads/saxon9he.jar
    • Go to cocoon and open pom.xml
    • At the bottom of , add:
      net.sf.saxonsaxon9.2.1.2
    • If for some reason you only want Saxon 9 and not the ability to generate HTML, skip to the bottom of this section
  • Installing HTML support
    • Still in pom.xml, at the bottom of , add:
      org.apache.cocooncocoon-html-impl1.0.0
  • Installing FOP (for PDFs)
    • Still in pom.xml, at the bottom of , add:
      org.apache.cocooncocoon-fop-impl1.0.0
  • Installing Batik (SVG)
    • Still in pom.xml, at the bottom of , add:
      org.apache.cocooncocoon-batik-impl1.0.0
  • Installing Forms
    • Still in pom.xml, at the bottom of , add:
      org.apache.cocooncocoon-forms-impl1.0.0-RC1
  • There's a list of all blocks, and the syntax for the dependency code is in there someplace.
  • Once you're done adding dependencies:
    • If you have a Terminal open with [INFO] Started Jetty Server, close it.
    • Open a new Terminal
      cd cocoon
                  
      mvn compile
    • After it's done...
      mvn jetty:run
  • Redirecting the Sitemap

    You can add your pipelines to the sitemap.xmap in cocoon/src/main/resources/COB-INF, or (more conveniently) you can tell that base sitemap to look elsewhere for your files.

    I'm assuming here that you have a folder called myproject in your Home folder where you have all your files and your sitemap. Please change that, and your user name, accordingly.

    Included here is also the code to generate more useful error messages than a blank pages.

    In sitemap.xmap in cocoon/src/main/resources/COB-INF, at the bottom of the
    section, add:

    In this case, your project will be found at http://localhost:8888/cocoon/myproject/[things that match your pipelines]. But it doesn't have to match the folder name with your files. You can change the URL by chanigng to

    Hints and Tips

    Every time you restart Ubuntu, you have to restart Cocoon:

    cd cocoon
    mvn jetty:run

    Be sure to keep that Terminal window open while you're working with Cocoon. You can always check if Cocoon is working by going to: http://localhost:8888/cocoon.

    This guide was prepared with help from a guide written on the GSLIS wiki by Wendell Piez. If you try it and something doesn't work, please post a comment. This document is licensed Creative Commons Attribution.

    Tags: 

    A tale of two Maverick wallpapers

    After seeing a call for artwork for Ubuntu 10.10 wallpapers on OMG! Ubuntu, I submitted a handful of photos to the Ubuntu Artwork pool on Flickr, just for kicks. Not long after, I discovered that two of my photos-- the feather and the happy cinnamon-- made the final 17 chosen for inclusion in the Maverick release. It's an honor, and a geeky dream come true. To celebrate the release of Ubuntu 10.10, here are the stories behind the two photos.

    The feather

    Cat toyFeatherDescribed as "the less interesting picture, but better desktop wallpaper", the feather has an equally unremarkable story. I had recently acquired a Canon MP-E 65mm f/2.8 1-5x Macro lens, and had gotten into the habit of crawling around the floor, taking macro pictures of anything that looked interesting. (I even walked up to my boss and asked if I could take a macro picture of his shirt, and he kindly humored me.) One of the things I found to take a picture of was a cat toy that had feathers on it-- and out of that cat toy, the feather photo was born.

    Happy Cinnamon

    Day 25: Smile!I've posted over 50,000 photos to Flickr, so a competition for my "favorite photograph" would be a fierce one. Happy Cinnamon would undoubtedly make the top 5. It was January 25, 2008, and a cold Chicago winter. Andy and I went up to Devon Ave., home of the Patel Brothers grocery store and super-cheap spices. We had some mulled wine at ZooLights a few weeks earlier, and needed some cinnamon sticks to re-create the experience. The happy cinnamon is glad you're hereI took one out of the package and looked at it from one end, and was utterly delighted to see it smiling at me. That photo became my picture-of-the-day for January 25th.

    March came, and it was still cold and dreary, and I decided that my part of the office (which included the door to the entire space) needed some color... much to the chagrin of my more button-down co-workers. I put up a rainbrow made of macro photos of food, and encouraged visitors to guess what each photo was while they were waiting. Happy cinnamon, the wrong hue to be included in the rainbow, got the place of honor: right opposite the door, so it could greet everyone who walked in.

    Where is Happy Cinnamon now?I eventually re-decorated, then moved offices, but I took Happy Cinnamon home. It's bounced around my apartment, but most recently it's been positioned between the kitchen and the living room. Every morning when I open the bedroom door, Happy Cinnamon is smiling at me from the other end of the hallway. Every evening when I come home from work, Happy Cinnamon is there, above the table where I pile stuff to sort out later.

    Whether or not Happy Cinnamon is the best choice for a desktop wallpaper (the point has been well-made that there's perhaps too much contrast for it to be ideal), I'm glad my serendipitous realization that cinnamon sticks smile at you is today in the hands of thousands.

    Tags: 

    Chrono Trigger on SNesoid: the Arris Dome password trick

    Chrono Trigger and SNesoidI was delighted to discover SNesoid for Android, which has let me relive my favorite childhood games, particularly Chrono Trigger. But in 2300 AD, after spending a half-hour chasing a rat across the screen to extract the password from it, it looked like SNesoid wasn't able to support hitting the three necessary buttons together (L + R, then A). And then this Android Forum thread caused me to look into key mapping.

    To enter the password and get on with the game:
    1) Hit the menu button in SNesoid
    2) Go to Input settings, then Key mappings
    3) Scroll down and select Button A. When it says Press a hardware key... press one that doesn't already cause a change of state in the app (i.e., don't choose the "home" or "menu" buttons.) I went with the volume down button.
    4) Go back to the game, and stand in front of the sparkling panel where you need to enter the password
    5) Keep a finger on both the L and R "keys" on the on-screen keyboard, and then hit the physical volume down button (or whatever button you chose in the key mappings interface.)

    And that's all! Go back to the key mappings interface and get rid of the key assignment for Button A, and head across the bridge discover that Lavos destroyed the world in 1999.

    Note: I'm running SNesoid 2.0.4 on an Unrevoked Forever Evo 4G with Froyo. Your mileage may vary.

    Additional dorky footnote: I loved Chrono Trigger so much that I made a mask of Mune in art class when I was 11, and spent hours playing the game and transcribing all the dialog in a Word file that I then used to write a novelization that inevitably focused primarily on Lucca, my very favorite character. Embarrassingly, in re-playing the game I discovered I can still quote back much of the dialog before even seeing it.

    Tags: 

    Pages

    Subscribe to Blog