forked from androidx/androidx
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for text decoration line styles via PlatformTextStyle
- Loading branch information
Showing
3 changed files
with
129 additions
and
10 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/TextDecorationLineStyle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2024 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package androidx.compose.ui.text | ||
|
||
import kotlin.jvm.JvmInline | ||
|
||
/** | ||
* Defines the style of the text decoration line (e.g. underline). | ||
* | ||
* The decoration itself is determined via [androidx.compose.ui.text.style.TextDecoration]. | ||
*/ | ||
@ExperimentalTextApi | ||
@JvmInline | ||
value class TextDecorationLineStyle internal constructor(val value: Int) { | ||
|
||
override fun toString(): String { | ||
return when (this) { | ||
Solid -> "Solid" | ||
Double -> "Double" | ||
Dotted -> "Dotted" | ||
Dashed -> "Dashed" | ||
Wavy -> "Wavy" | ||
else -> "Invalid" | ||
} | ||
} | ||
|
||
companion object { | ||
/** | ||
* Solid line. | ||
*/ | ||
val Solid = TextDecorationLineStyle(1) | ||
|
||
/** | ||
* Double line. | ||
*/ | ||
val Double = TextDecorationLineStyle(2) | ||
|
||
/** | ||
* Dotted line. | ||
*/ | ||
val Dotted = TextDecorationLineStyle(3) | ||
|
||
/** | ||
* Dashed line. | ||
*/ | ||
val Dashed = TextDecorationLineStyle(4) | ||
|
||
/** | ||
* Wavy line. | ||
*/ | ||
val Wavy = TextDecorationLineStyle(5) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters