Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading a font #33

Closed
1 task done
davelab6 opened this issue Jun 14, 2016 · 8 comments
Closed
1 task done

Loading a font #33

davelab6 opened this issue Jun 14, 2016 · 8 comments
Assignees

Comments

@davelab6
Copy link
Contributor

davelab6 commented Jun 14, 2016

  • The Number 2 feature is loading a previously saved font (in source format)
@YashAgarwal
Copy link
Contributor

loading the ufo is done using defcon

self.main_path = "ufo/sample.ufo"
self.main_font = Font(self.main_path)       

for some ufo files this fails and gives the error

Error: defcon.errors.DefconError: the kerning data is not valid

saving a ufo file is also done through defcon

self.main_font.save(file_name)

but I'm getting the same error as above for all the ufo files I tried

@YashAgarwal
Copy link
Contributor

Using Object Chooser I am not able to see the files corresponding to the following mime types

application/x-font-opentype
application/font-sfnt
application/x-plist
application/xml
application/octet-stream

I have added all of them in my activity.info file

and here's how I'm calling the Object Chooser dialog

try:
    chooser = ObjectChooser(
        parent=self,
        what_filter=self.get_bundle_id(),
        filter_type=FILTER_TYPE_MIME_BY_ACTIVITY)
except:
    chooser = ObjectChooser(parent=self,
                            what_filter=mime.GENERIC_TYPE_TEXT)

I only see the above-mentioned file types if I select the Anything filter in the Object Chooser dialog

@YashAgarwal
Copy link
Contributor

I ran Gio.content_type_guess("file.plist", None)[0] which gives the output application/octet-stream

@davelab6
Copy link
Contributor Author

davelab6 commented Jul 1, 2016

Can you set the dialog to open with 'Anything' preselected?

If not, I guess the OS has a mime registry that lacks definitions for these mime types. Perhaps @quozl knows how OLPC OS mime types are defined, and can suggest how you might be able to get these added to the next release...

Or, you could use application/zip which should allow you to pick .ufoz files - this is cutting edge technology, specified in draft form at http://unifiedfontobject.org/roadmap , but I think it would be good for Sugar as its more compact on-disk.

Then with the file object returned by the ObjectChooser(), you can unzip it with Python, and then deal with its files directly, I guess?

@YashAgarwal
Copy link
Contributor

YashAgarwal commented Jul 1, 2016

Can you set the dialog to open with 'Anything' preselected?

I don't know the syntax for this, but I'll look for it

Or, you could use application/zip which should allow you to pick .ufoz files - this is cutting edge technology, specified in draft form at http://unifiedfontobject.org/roadmap , but I think it would be good for Sugar as its more compact on-disk.

Then with the file object returned by the ObjectChooser(), you can unzip it with Python, and then deal with its files directly, I guess?

This sounds doable, I'll start with this then

@quozl
Copy link
Contributor

quozl commented Jul 1, 2016

OLPC OS on Fedora 18 and also Ubuntu 16.04 lack any definition of;

  • MIME types application/x-font-opentype, application/font-sfnt or application/x-plist,
  • file types .plist, or .ufo.

Don't restrict your activity to a presumed future operating system release.

Use a local MIME registry. This is to reside in ~/.local/share/mime and may contain magic, globs or other files. strace -e open has been used to prove.

You might select relevant lines from a later version of /usr/share/file/magic that describe your file formats, and add them to ~/.local/share/mime/magic under control of the activity.

@davelab6
Copy link
Contributor Author

davelab6 commented Jul 6, 2016

@YashAgarwal is the ufo zip format working for load and save?

@davelab6
Copy link
Contributor Author

It work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants