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. 💰
- Host: GitHub
- URL: https://github.com/st235/richtextview
- Owner: st235
- License: mit
- Created: 2018-01-16T09:26:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-03T06:55:05.000Z (almost 8 years ago)
- Last Synced: 2025-09-07T05:44:20.410Z (10 months ago)
- Topics: android, assets, fonts, icons, java, library, performance, text
- Language: Java
- Homepage:
- Size: 384 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[  ](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.