GithubHelp home page GithubHelp logo

ahmedhaies / arabtype Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eloraiby/arabtype

0.0 0.0 0.0 166 KB

a small and simple implementation that transform isolated arabic utf8 character strings into contextual forms.

C 71.30% C++ 25.41% QMake 3.29%

arabtype's Introduction

Arabtype

A small and simple implementation that transform isolated arabic utf8 character strings into contextual forms useful for rendering (rendering example is provided).

This is mostly suitable for lightweight UIs (embedded systems, games, media players...). It's worthy to note that this is far more lightweight than HarfBuzz (used by Qt/Pango...). Freetype 2 on the other hand lacks this functionality.

Usage

One call will convert a utf8 string to a sequence of code points:

size_t get_presentation_form_b(size_t in_len,
                               unsigned char *in_str,
                               size_t out_len,
                               uint32_t* out_cp);

Where

in_len: the input utf8 string length in bytes

in_str: the input utf8 string

out_len: output code point buffer size (in bytes)

out_cp: output code point buffer

return: return the total number of code points transformed

Details

Arabic letters have 4 forms: Isolated, Initial, Medial and Ending. An arabic letter will have one of these forms depending on the letters preceding and succeeding it: For instance take the letter ﺡ : This is the isolated form (i.e. nothing precedes nor succeeds it), if it comes at the start of a syllable it will have the initial form ( ﺣ ). If it ends a syllable it will have the ending form ( ﺢ ) and if it is in the middle of a syllable it will have the medial form ( ﺤ ). Some even have more complicated ligature forms (such as Lam and Alef together: ﻻ ) . A utf8 arabic string usually only comprises of isolated letters from Arabic Unicode Block. With this library you will transform it to the rendering/presentation form: Arabic Presentation Forms B

Example (Khalil Gibran's Al-Nay)

ScreenShot

LICENSE

Arabtype, Copyrights 2012-2015(c) Wael El Oraiby. All rights reserved.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3 for more details.

Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation.

Roughly speaking: it means that you can statically link with the code but you are obliged to make open your bug fixes and/or enhancement to the arabtype.c/arabtype.h code.


The utf8.c file is under the following license:

Copyright (c) 2008-2009 Bjoern Hoehrmann <[email protected]>

See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.

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.

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.