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

https://github.com/st235/richtextview

A simple way to work with icon fonts. 💰
https://github.com/st235/richtextview

android assets fonts icons java library performance text

Last synced: 4 months ago
JSON representation

A simple way to work with icon fonts. 💰

Awesome Lists containing this project

README

          

[ ![Download](https://api.bintray.com/packages/st235/maven/richtextview/images/download.svg?version=0.0.3) ](https://bintray.com/st235/maven/richtextview/0.0.3/link)

# RichTextView

## Install

From maven

```xml

com.github.st235
richtextview
0.0.3
pom

```

From gradle

```
implementation 'com.github.st235:richtextview:0.0.3'
```

## Usage

First of all, the library must be initialized. If this step is omitted, the attempt to use will generate an exception.

```java
public class App extends Application {

@Override
public void onCreate() {
super.onCreate();

FontProvider.init(getAssets());
}
}
```

View easily configurable from the markup,

```xml

```
but if you need to download the font manually from the Assets, not everything is lost!

```java
/**
* loads the font in the specified path relative to the assets folder.
* @param fontAsset - font link
*/
public void loadFont(@Nullable String fontAsset)
```

Also, you can use the Span to display custom fonts with _CustomFontSpan_.

```java
final TextView footer = ...;
SpannableString footerText = new SpannableString( "\uf0e7 Font Awesome (http://fontawesome.io/)");
footerText.setSpan(new CustomFontSpan("", "fontawesome-webfont.ttf"), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
footer.setText(footerText);
```

## License

MIT License

Copyright (c) 2018 Alexander Dadukin

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.