Giter VIP home page Giter VIP logo

sheenfigure's Introduction

SheenFigure

License Build Status Coverage Status

SheenFigure aims to implement the advanced typographic tables of OpenType specification available at https://www.microsoft.com/en-us/Typography/OpenTypeSpecification.aspx along with script specific shaping engines available at https://www.microsoft.com/en-us/Typography/SpecificationsOverview.aspx. Currently, it only supports Arabic script and a subset of GDEF, GSUB and GPOS tables. The support is intended to increase in each newer versions of the library.

Here are some of the advantages of SheenFigure.

  • Object based
  • Designed to be thread safe
  • Lightweight API for interaction
  • Clear differentiation of public and private API
  • Thoroughly tested

Dependency

SheenFigure only depends on SheenBidi in order to support UTF-8, UTF-16 and UTF-32 string encodings. Other than that, it only uses standard C library headers stddef.h, stdint.h, stdlib.h and string.h.

Configuration

The configuration options are available in Headers/SFConfig.h.

  • SF_CONFIG_UNITY builds the library as a single module and lets the compiler make decisions to inline functions.

Compiling

SheenFigure can be compiled with any C compiler. The best way for compiling is to add all the files in an IDE and hit build. The only thing to consider however is that if SF_CONFIG_UNITY is enabled then only Source/SheenFigure.c should be compiled.

Public API

Here is a glimpse of public API in the form of UML class diagram. Public API

Conformance

Following are the tables implemented by SheenFigure.

OpenType Layout Common Table Formats

Table Supported
Script List ✔️
Feature List ✔️
Lookup List ✔️
Coverage ✔️
Class Definition ✔️
Device ✔️
Variation Index ✔️

GDEF (Glyph Definition Table)

Subtable Supported
Glyph Class Definition ✔️
Attachment List
Ligature Caret List
Mark Attachment Class Definition ✔️
Mark Glyph Sets ✔️
Item Variation Store ✔️

GPOS (Glyph Positioning Table)

Subtable Format 1 Format 2 Format 3
Single Adjustment ✔️ ✔️
Pair Adjustment ✔️ ✔️
Cursive Attachment ✔️
Mark To Base Attachment ✔️
Mark To Ligature Attachment ✔️
Mark To Mark Attachment ✔️
Context Positioning ✔️ ✔️ ✔️
Chained Context Positioning ✔️ ✔️ ✔️
Extension Positioning ✔️

GSUB (Glyph Substitution Table)

Subtable Format 1 Format 2 Format 3
Single ✔️ ✔️
Multiple ✔️
Alternate ✔️
Ligature ✔️
Context ✔️ ✔️ ✔️
Chaining Context ✔️ ✔️ ✔️
Extension ✔️
Reverse Chaining Context ✔️

sheenfigure's People

Contributors

mta452 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sheenfigure's Issues

Retreiving caret edges from SFAlbum

Even though SFAlbum provides mapping from code unit to glyph index, caret positions need to be calculated manually. The process is very complex as the caret should not stop at some code units such as surrogates, or the caret adjustments should be identified in cases of character/glyph clusters. There can be ligatures whose effective caret positions should be obtained from Ligature Caret List Table.

Since caret handling is very fundamental need of text editing, having it implemented in SFAlbum would be very helpful. The logic can be borrowed from loadCharExtents method in Tehreer-Android project.

Limit the buffer size and execution time

To prevent attacks, impose an upper limit on buffer size and execution time when shaping text. For example, increment a counter on the number of executed OpenType lookups and give up when it gets excessive, and make sure that the rendering buffer does not get excessively large; check out how HarfBuzz does this. See test case GSUB-3.

Motivation

Hi,

I'm curious. What's the motivation for writing this library? Why couldn't you use HarfBuzz?

Remove unicode general category lookup

The support for getting the general category of a code point has been added in SheenBidi. It would be a good idea to use that method instead of duplicating the lookup feature here in SheenFigure as well.

Default script selection

The current implementation only selects the provided script tag, but the OpenType specification defines a fallback mechanism. The relevant paragraph from Common Table Formats is following.
An application should use a DFLT script table if there is not a script table associated with the specific script of the text being formatted, or if the text does not have a specific script (for example, it contains only symbols or punctuation).

Invalid code unit to glyph map for backward text mode

The code unit to glyph map is correctly produced for forward text mode. In case of backward text mode, it remains correct for 1-1 mapping. But if there are ligatures or multiple substitutions, it becomes invalid.

Revise font class for variable fonts

In order to support variable fonts, some adjustments are required in the font class. As variable fonts can substitute the features, it is not possible to select a variable instance in the artist. There should perhaps be a function to create a variable instance of the font from the default one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.