Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/LiveUI/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.
https://github.com/LiveUI/FTCoreText

coretext html ios objective-c swift

Last synced: 2 months ago
JSON representation

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.

Awesome Lists containing this project

README

        

# 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
```objective-c
#import FTCoreTextView.h
```

#### 2. Create an instance of `FTCoreTextView`

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

```objective-c
// Draw text closed in tag in red color
// Example: this will be drawn red
FTCoreTextStyle *redStyle = [FTCoreTextStyle styleWithName:@"red"];
redStyle.color = [UIColor redColor];
```

#### 4. Once styles are defined, apply them to the view:
```objective-c
[ftCoreTextInstance addStyles:@[style1, style2, style3]];
```

#### 5. Set text with corrent markdown to the `FTCoreTextView` instance
```objective-c
ftCoreTextInstance.text = @"My text with 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`.
- `FTCoreTextTagImage`: renders images. Markup: `<_image>imageNameOnBundle.extension`
- `FTCoreTextTagLink`: define style for links. Markup: `<_link>link_target|link - name`. 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://xprogress.com|xProgress`

## 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 LiveUI & [manGoweb](http://www.mangoweb.cz/en). Please [drop us an email](mailto:[email protected]) 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) 2011-2018 LiveUI

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.