[go: nahoru, domu]

blob: fc3a963be72188c2e92cd05f1f4651855c19d9f7 [file] [log] [blame]
/*
* Copyright 2019 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.ui.material
import androidx.compose.Ambient
import androidx.ui.core.sp
import androidx.ui.text.TextStyle
import androidx.ui.text.font.FontFamily
import androidx.ui.text.font.FontWeight
/**
* Data class holding typography definitions as defined by the [Material typography specification](https://material.io/design/typography/the-type-system.html#type-scale).
*/
data class Typography(
// TODO(clara): case
// TODO(clara): letter spacing (specs don't match)
// TODO(clara): b/123001228 need a font abstraction layer
val h1: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.W100,
fontSize = 96.sp),
val h2: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.W100,
fontSize = 60.sp),
val h3: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.Normal,
fontSize = 48.sp),
val h4: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.Normal,
fontSize = 34.sp),
val h5: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.Normal,
fontSize = 24.sp),
val h6: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.W500,
fontSize = 20.sp),
val subtitle1: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.Normal,
fontSize = 16.sp),
val subtitle2: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.W500,
fontSize = 14.sp),
val body1: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.Normal,
fontSize = 16.sp),
val body2: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.Normal,
fontSize = 14.sp),
val button: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.W500,
fontSize = 14.sp),
val caption: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.Normal,
fontSize = 12.sp),
val overline: TextStyle = TextStyle(
fontFamily = FontFamily("Roboto"),
fontWeight = FontWeight.Normal,
fontSize = 10.sp)
)
/**
* This Ambient holds on to the current definition of typography for this application as described
* by the Material spec. You can read the values in it when creating custom components that want
* to use Material types, as well as override the values when you want to re-style a part of your
* hierarchy. Material components related to text such as [Button] will use this Ambient
* to set values with which to style children text components.
*
* To access values within this ambient, use [MaterialTheme.typography].
*/
internal val TypographyAmbient = Ambient.of { Typography() }