Fixed
Status Update
Comments
uc...@google.com <uc...@google.com> #2
Able to repro on API 34, Compose ToT. I shortened the repro,
Sean, could you take a peek at this? It seems like there may be a disconnect between the font changing and then not picking up the correct weight. That or something is off with the way the font is created here, but I'm not certain.
rp...@google.com <rp...@google.com>
sp...@google.com <sp...@google.com> #3
Forgot one part of the repro, you will need the
sp...@google.com <sp...@google.com> #4
Clearly caching bug, minimal repro:
al...@glowing.com <al...@glowing.com> #5
private val fontWeights = listOf(100, 200, 300, 400)
private val fonts = listOf(
"Azeret" to R.font.azeret_mono,
"Roboto Mono" to R.font.roboto_mono,
)
@OptIn(ExperimentalTextApi::class)
private val fontFamilies = fonts.map { (_, resId) ->
FontFamily(
fontWeights.map { weight ->
Font(
resId = resId,
weight = FontWeight(weight),
variationSettings = FontVariation.Settings(FontVariation.weight(weight))
)
}
)
}
@Composable
fun Demo() {
Column {
FullListRepro()
// FullListOK()
}
}
@Composable
fun FullListRepro() {
Column {
fontWeights.forEach { weight ->
fonts.forEachIndexed { i, (familyName, _) ->
val fontFamily = fontFamilies[i]
val style = TextStyle(
fontFamily = fontFamily,
fontWeight = FontWeight(weight),
fontSize = 40.sp
)
BasicText("$weight $familyName", style=style)
}
}
}
}
@Composable
fun FullListOK() {
Column {
fonts.forEachIndexed { i, (familyName, _) ->
fontWeights.forEach { weight ->
val fontFamily = fontFamilies[i]
val style = TextStyle(
fontFamily = fontFamily,
fontWeight = FontWeight(weight),
fontSize = 40.sp
)
BasicText("$weight $familyName", style=style)
}
}
}
}
OK composable is fine, but if you switch the order you see the incorrect behavior coming from resource font loading.
al...@glowing.com <al...@glowing.com> #6
We had a similar kind of issue...
When setting the fontWeight, either in the TextStyle, or in the TextField, ... 100-300 shows same weight, 400-600 shows same weight etc ...
When setting it as FontVariation.Setting it is working correctly ...
Is this need to explicitly mention for variable fonts ?
When setting the fontWeight, either in the TextStyle, or in the TextField, ... 100-300 shows same weight, 400-600 shows same weight etc ...
When setting it as FontVariation.Setting it is working correctly ...
Is this need to explicitly mention for variable fonts ?
Description
However the plugin only allow me to select "app/res"
And It works will before I upgrade Android Studio to 3.3.1.
Build: 3.3.1, AI-182.5107.16.33.5264788, 201901282352,
AI-182.5107.16.33.5264788, JRE 1.8.0_152-release-1248-b01x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.12.6 unknown, screens 1440x900, 1920x1200; Retina
Android Gradle Plugin: 3.3.1
Gradle: 4.10.1
NDK: from local.properties: (not specified); latest from SDK: (not found);
LLDB: pinned revision 3.1 not found; latest from SDK: (package not found);
CMake: from local.properties: (not specified); latest from SDK: (not found); from PATH: (not found);
Source: user_sentiment_feedback
IMPORTANT: Please read