@@ -43,6 +43,7 @@ import androidx.compose.ui.layout.Placeable
4343import androidx. compose. ui. layout. ScaleFactor
4444import androidx. compose. ui. platform. LocalContext
4545import androidx. compose. ui. platform. LocalDensity
46+ import androidx. compose. ui. text. font. FontWeight
4647import androidx. compose. ui. unit. dp
4748import coil3. compose. SubcomposeAsyncImage
4849import coil3. request. ImageRequest
@@ -277,8 +278,34 @@ public struct Image : View, Renderable, Equatable {
277278 parseSymbolXML ( url)
278279 }
279280
281+ func swiftFontWeight( from composeFontWeight: FontWeight ? ) -> Font . Weight ? {
282+ guard let composeFontWeight else {
283+ return nil
284+ }
285+ if composeFontWeight == FontWeight . Thin {
286+ return . ultraLight
287+ } else if composeFontWeight == FontWeight . ExtraLight {
288+ return . thin
289+ } else if composeFontWeight == FontWeight . Light {
290+ return . light
291+ } else if composeFontWeight == FontWeight . Normal {
292+ return . regular
293+ } else if composeFontWeight == FontWeight . Medium {
294+ return . medium
295+ } else if composeFontWeight == FontWeight . SemiBold {
296+ return . semibold
297+ } else if composeFontWeight == FontWeight . Bold {
298+ return . bold
299+ } else if composeFontWeight == FontWeight . ExtraBold {
300+ return . heavy
301+ } else if composeFontWeight == FontWeight . Black {
302+ return . black
303+ }
304+ return nil
305+ }
306+
280307 // match the best symbol for the current font weight
281- let fontWeight = EnvironmentValues . shared. _textEnvironment. fontWeight ?? Font . Weight. regular
308+ let fontWeight = EnvironmentValues . shared. _textEnvironment. fontWeight ?? swiftFontWeight ( from : EnvironmentValues . shared . font ? . fontImpl ( ) . fontWeight ) ?? Font . Weight. regular
282309
283310 // Exporting as "Static" will contain all 27 variants (9 weights * 3 sizes),
284311 // but "Variable" will only have 3: Ultralight-S, Regular-S, and Black-S
0 commit comments