android - Low Level Text Engine for Tablet OS -


background: develop software viewing specialized academic content complex layout requirements (complex footnotes, tables, images, non-standard character sets, etc.) in desktop version accomplished wpf's low-level textformatter , in web app accomplished flash's fte (not tlf, underlying engine). both of these low-level engines produce text lines of specified width , formatting, can arranged form pages.

we port application ipad , android tablets. @ moment leaning towards using air android/packager iphone reuse of our existing as3 codebase. however, want explore option of going native on each platform.

my question is: ios , android offer comparable low-level text engine capable of:

  1. line breaking in varying widths
  2. bidirectional text
  3. kerning, ligatures, etc.
  4. multiple embedded fonts
  5. inline , floating images
  6. text selection/highlighting
  7. anything else necessary produce complex layouts

assuming not offered native apis (and @ least looking on android sdk seems case), there third party frameworks available these platforms of above?

in ios, there coretext framework. (offered in c language) think suitable you. here reference documentation. http://developer.apple.com/library/ios/#documentation/stringstextfonts/conceptual/coretext_programming/introduction/introduction.html


apple has 1 of strongest typographic technology adobe. far know, technologies not compatible. (except font , pdf) coretext has features similar adobe's one, behaves differently. have tweak layout values again.

i'm not sure of features listed supported.

  • line spacing,
  • kerning,
  • variety fonts,
  • inline object (like images) layout,
  • and etc

was supported in initial release of coretext framework ios. can't sure other features ligature, bidirectional flow. (because didn't tested) , selection, checked related feature offered in other framework have not used it.

there issues in initial release of coretext. described here: (1) aligning multiple sized text vertical center instead of baseline core text in ios (2) core text: render odd shape

the coretext mac os x framework. , gradually being ported ios. have not used coretext on mac, when checked doc, has many more features. expect features ported. apple porting many mac features aggressively.

i have used flash (not in-depth level in fonts) , i'm satisfying on apple's framework. believe not disappointed it. know, apple 1 of opener of computer typographic era. (the other 1 adobe :)


the framework looks little bit hardcore, it's easy use looks. can draw nsattributedstring (rich-text object) is, , have making nsattributedstring instance , draw coretext.

for example, if have configured nsattributedstring, code draw every rich-text in specific rectangle area.

// in uiview subclass. - (void)drawrect:(cgrect)rect {     nsattributedstring*  =   [self text]; // assumes property exist.     cgcontextref        ctx =   uigraphicsgetcurrentcontext();     cgmutablepathref    p   =   cgpathcreatemutable();     cgrect              r   =   rect;     cgpathaddrect(p, null, r);      ctframesetterref    fs  =   ctframesettercreatewithattributedstring((cfattributedstringref)as);     ctframeref          f   =   ctframesettercreateframe(fs, cfrangemake(0, 0), p, null);      ctframedraw(f, ctx);      cfrelease(fs);           cgpathrelease(p); 

of course drawn graphics flipped unless call code @ somewhere.

    [[self layer] setgeometryflipped:yes]; 

and if you're finding alternative of native typographic/layout framework, there 2 options.

  1. html+css
  2. freetype library

html uiwebview can one. @ css3 , later. there pretty many features people expect. however, html , uiwebview lot heavier , slower coretext. used coretext drawing in uitableviewcell without struggling on scrolling animation.

freetype library extremely low level font library. offers lowest level of direct access font data , rendering facility anti-aliasing. because it's low level, should implement layout logic yourself. don't know library well.


i don't know android.


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -