GithubHelp home page GithubHelp logo

china-maid / ftcoretext Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liveui/ftcoretext

0.0 2.0 0.0 1.69 MB

An open source Objective-C interface component that makes use of the CoreText framework to render static text content using a highly customisable markup syntax.

License: MIT License

ftcoretext's Introduction

#FTCoreText

An open source Objective-C interface component that makes use of the CoreText framework to render static text content using a highly customisable markup syntax.

FTCoreText \ FTCoreText \ FTCoreText inlined Base64-encoded images example screenshot

##Usage

Implement FTCoreText into your project

Manually

  1. Download FTCoreText sources from repository
  2. Add files in FTCoreText folder to your project
  3. Include CoreText.framework in your project

Using CocoaPods

  1. Use FTCoreText pod

Use FTCoreTextView

1. Import FTCoreText

#import FTCoreTextView.h

2. Create an instance of FTCoreTextView

3. Create styles to apply to the output by creating instances of FTCoreTextStyle

//  Draw text closed in <red> tag in red color
//  Example: <red>this will be drawn red</red>
FTCoreTextStyle *redStyle = FTCoreTextStyle *imageStyle = [FTCoreTextStyle styleWithName:@"red"];
redStyle.color = [UIColor redColor];

4. Once styles are defined, apply them to the view:

[ftCoreTextInstance addStyles:@[style1, style2, style3]];

5. Set text with corrent markdown to the FTCoreTextView instance

ftCoreTextInstance.text = @"My text with <red>red</red> word.";

See the included examples project highlighting various features.

##Elements

FTCoreText provides some interface element types for rendering content types commonly found on the web and printed media such as lists, images, links and suchlike.

Included:

  • FTCoreTextTagDefault: the default style applied to the text.
  • FTCoreTextTagPage: Divide the text in pages. Markup: <_page/>
  • FTCoreTextTagBullet: define styles for bullets. Markup: <_bullet>content</bullet>.
  • FTCoreTextTagImage: renders images. Markup: <_image>imageNameOnBundle.extension</_image>
  • FTCoreTextTagLink: define style for links. Markup: <_link>link_target|link - name</_link>. See FTCoreTextViewDelegate for responding to touch.

To use the included element types, set the name of an FTCoreTextStyle style instance to one of the string constant types above and use the markup specified. Example: linkTypeFTCoreTextStyleInstance.name = FTCoreTextTagLink, and in the static content: <_link>http://fuerteint.com|Fuerte International</_link>

##Notes

  1. Use of the CoreText framework is available for iOS versions 3.2 and above.

  2. Although FTCoreTextView uses a similar markup syntax to HTML, most of the properties defined in the HTML specification are unsupported.

##Contact

FTCoreText is developed by FuerteInt. Please drop us an email to let us know you how you are using this component.

##License

Open Source Initiative OSI - The MIT License (MIT):Licensing [OSI Approved License] The MIT License (MIT)

Copyright (c) 2013 Fuerte International

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.