https://github.com/ehsannarmani/isolatedtext
A Library for defining separeted style for each type of word in Jetpack Compose
https://github.com/ehsannarmani/isolatedtext
android android-kotlin compose compose-library compose-text isolated-text jetpack-compose kotlin kotlin-android text-compose text-style text-style-compose
Last synced: 8 months ago
JSON representation
A Library for defining separeted style for each type of word in Jetpack Compose
- Host: GitHub
- URL: https://github.com/ehsannarmani/isolatedtext
- Owner: ehsannarmani
- Created: 2023-09-05T13:18:52.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-05T14:45:10.000Z (almost 3 years ago)
- Last Synced: 2025-04-09T04:34:15.258Z (about 1 year ago)
- Topics: android, android-kotlin, compose, compose-library, compose-text, isolated-text, jetpack-compose, kotlin, kotlin-android, text-compose, text-style, text-style-compose
- Language: Kotlin
- Homepage:
- Size: 466 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IsolatedText
#### You can define separeted style for each type of words: english, non english, numbers and misc words.
#### For Example with this library you can define ubuntu font for english words, chewy font for numbers, y font for non english words, also you can define all of text styles, for exmaple you can define blue color to english words, 20 sp size to numbers and ...

## Instalation:
### Add Jitpack Repository:
```groovy
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
```
### Add Dependency:

```groovy
implementation 'com.github.ehsannarmani:IsolatedText:latest_version'
```
## Basic Usage:
```kotlin
IsolatedText(
text = "...",
fonts = listOf(
WordType.English to ubuntuFont,
WordType.NonEnglish to vazirFont,
WordType.Number to chewyFont,
WordType.Misc to knickFont
)
)
```
## Complementary Usage:
```kotlin
IsolatedText(
text = text,
WordType.English to WordStyle(
fontFamily = ubuntuFont,
fontSize = 16.sp,
),
WordType.NonEnglish to WordStyle(
fontFamily = vazirFont,
fontSize = 20.sp,
shadow = Shadow(
color = Color(0xff313131),
Offset(4f, 4f),
blurRadius = 7f
),
color = Color(0xFF212121),
baselineShift = BaselineShift(0.1f),
),
WordType.Number to WordStyle(
fontFamily = knickFont,
fontSize = 18.sp,
color = Color(0xFF0960CA),
letterSpacing = 6.sp,
textDecoration = TextDecoration.Underline,
background = Color(0xA8FFEB2F)
),
WordType.Misc to WordStyle(
fontFamily = blomFont,
fontSize = 20.sp,
color = Color.Red,
),
miscWords = defaultMiscWords - ",",
textAlign = TextAlign.Justify
)
```
### Misc Words:
#### You can define any misc words you want in miscWords parameter, example:
```kotlin
miscWords = listOf("<",">")
```