Check The GitHub Repository

Sugar Font Editor Activity

Kids Make Fonts

Week 2 + 3 Work

2016-06-14

By Yash Agarwal (GSoC Student)

During Week 2 I was away at a prior academic engagement agreed with Eli and Dave, and I will be working over the weekends to make up the time from now until the mid-term evaluation.

During Week 3, I tackled the following 3 areas:

Setting Up Travis

https://github.com/sugarlabs/edit-fonts-activity/issues/17 tracked this request from Dave.

I couldn’t get past an issue with the ./osbuild shell command timing out every time, so I raised an issue with travis-ci to learn how to overcome this.

Python Modules for Font File Load, Save, Import, and Export

Inside the activity, all fonts are loaded as defcon.Font objects. They can be saved and exported in UFO, TTF, OTF formats. I have figured out the commands and the libraries regarding this and next steps are to write the modules in the main activty and connect them to standard Sugar Toolkit UI buttons and dialogs.

To load/save an UFO is done simply by using defcon: This issue will be tracked here & here

from defcon import Font
font = Font(pathToUFO)

To import binary TTF and OTF fonts I have used typesupply’s extractor module. This issue will be tracked here

import extractor
f = RFont()
extractFontFromOpenType(pathTTF, f)

The next step is to convert the RFont object to a defcon.Font object.

To export binaries I have used google i18n’s ufo2ft module, the same as Trufont uses. This issue will be tracked here

from ufo2ft import compileTTF
from robofab.world import OpenFont
from defcon import Font
ufo = OpenFont('abc.ufo')
ttf = compileTTF(ufo)
ttf.save('MyFont-Regular.ttf')

Dave has made issues to track each of these 4 features to completion:

Font Editor Pages

I developed a couple of Page classes for the different ‘major mode’ parts of the Activity.

A summary:

class SummaryPage(Gtk.Box):
    """
    This Class Creates the "Font:<familyName>" Page 
    that loads up on clicking any Font
    """
    ...

And an editor:

class EditorPage(Gtk.Box):
    """
    This Class Creates the "Let's Edit Font:<familyName>" Page 
    that loads up on clicking any Glyph in the Character Map or 
    when the edit font button is clicked on the Font Summary page
    """

I also developed a PageManager Class, which is a subclass of the Gtk.Notebook Class, that will manage all the pages or modes of the activity.

Next steps are to make a singleton class so that there is only one instance of a PageManager Object, so I can switch to any page in the Notebook within any other class/file.