Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions example/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ symbolCraft {
directory = project.relativePath("src/commonMain/composeResources/files")
include("**/*.svg")
}

// Simple Icons - for testing Locale issue (GitHub issue #38)
externalIcons("github", libraryName = "simple-icons") {
urlTemplate = "https://simpleicons.org/icons/{name}.svg"
}
Comment on lines +139 to +142

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This configuration for simple-icons was added for testing the locale fix. While useful for verification, such test-specific setup should not be committed to the main branch. Please remove this block to keep the example project's configuration clean and focused on demonstrating the library's intended usage.

}

compose.desktop {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.github.kingsword09.example.icons.`simple-icons`

import androidx.compose.ui.graphics.vector.ImageVector
import io.github.kingsword09.example.icons.`simple-icons`.icons.GithubSimpleIcons
import kotlin.collections.List as ____KtList

public object Icons

private var __AllIcons: ____KtList<ImageVector>? = null

public val Icons.AllIcons: ____KtList<ImageVector>
get() {
if (__AllIcons != null) {
return __AllIcons!!
}
__AllIcons= listOf(GithubSimpleIcons)
return __AllIcons!!
}
Comment on lines +1 to +18

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This generated file appears to be an artifact of the test configuration added in build.gradle.kts. To keep the repository clean and the commit focused on the core fix, this file should be removed from the pull request.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package io.github.kingsword09.example.icons.`simple-icons`.icons

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import io.github.kingsword09.example.icons.`simple-icons`.Icons
import org.jetbrains.compose.ui.tooling.preview.Preview

public val Icons.GithubSimpleIcons: ImageVector
get() {
if (_githubSimpleIcons != null) {
return _githubSimpleIcons!!
}
_githubSimpleIcons = Builder(name = "GithubSimpleIcons", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero) {
moveTo(12.0f, 0.30f)
curveToRelative(-6.63f, 0.0f, -12.0f, 5.37f, -12.0f, 12.0f)
curveToRelative(0.0f, 5.30f, 3.44f, 9.8f, 8.21f, 11.39f)
curveToRelative(0.6f, 0.11f, 0.82f, -0.26f, 0.82f, -0.58f)
curveToRelative(0.0f, -0.29f, -0.01f, -1.04f, -0.02f, -2.04f)
curveToRelative(-3.34f, 0.72f, -4.04f, -1.61f, -4.04f, -1.61f)
curveTo(4.42f, 18.07f, 3.63f, 17.7f, 3.63f, 17.7f)
curveToRelative(-1.09f, -0.74f, 0.08f, -0.73f, 0.08f, -0.73f)
curveToRelative(1.21f, 0.08f, 1.84f, 1.24f, 1.84f, 1.24f)
curveToRelative(1.07f, 1.84f, 2.81f, 1.31f, 3.50f, 1.00f)
curveToRelative(0.11f, -0.78f, 0.42f, -1.31f, 0.76f, -1.61f)
curveToRelative(-2.67f, -0.3f, -5.47f, -1.33f, -5.47f, -5.93f)
curveToRelative(0.0f, -1.31f, 0.47f, -2.38f, 1.24f, -3.22f)
curveToRelative(-0.14f, -0.30f, -0.54f, -1.52f, 0.11f, -3.18f)
curveToRelative(0.0f, 0.0f, 1.01f, -0.32f, 3.3f, 1.23f)
curveToRelative(0.96f, -0.27f, 1.98f, -0.40f, 3.0f, -0.41f)
curveToRelative(1.02f, 0.01f, 2.04f, 0.14f, 3.0f, 0.41f)
curveToRelative(2.28f, -1.55f, 3.29f, -1.23f, 3.29f, -1.23f)
curveToRelative(0.65f, 1.65f, 0.24f, 2.87f, 0.12f, 3.18f)
curveToRelative(0.77f, 0.84f, 1.23f, 1.91f, 1.23f, 3.22f)
curveToRelative(0.0f, 4.61f, -2.81f, 5.63f, -5.48f, 5.92f)
curveToRelative(0.42f, 0.36f, 0.81f, 1.10f, 0.81f, 2.22f)
curveToRelative(0.0f, 1.61f, -0.02f, 2.90f, -0.02f, 3.29f)
curveToRelative(0.0f, 0.32f, 0.21f, 0.69f, 0.83f, 0.57f)
curveTo(20.57f, 22.09f, 24.0f, 17.59f, 24.0f, 12.30f)
curveToRelative(0.0f, -6.63f, -5.37f, -12.0f, -12.0f, -12.0f)
}
}
.build()
return _githubSimpleIcons!!
}

private var _githubSimpleIcons: ImageVector? = null

@Preview
@Composable
private fun Preview() {
Box(modifier = Modifier.padding(12.dp)) {
Image(imageVector = Icons.GithubSimpleIcons, contentDescription = "")
}
}
Comment on lines +1 to +67

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This generated icon file is part of the test setup for the locale fix. It should be removed from the pull request along with the other test-related artifacts to ensure the commit only contains the necessary bug fix.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.github.kingsword09.symbolcraft.converter
import io.github.kingsword09.svg2compose.Svg2Compose
import io.github.kingsword09.svg2compose.VectorType
import java.io.File
import java.util.Locale

/**
* SVG to Compose converter using the DevSrSouza/svg-to-compose library
Expand Down Expand Up @@ -190,9 +191,11 @@ class Svg2ComposeConverter {
"// Generated by SymbolCraft",
)
// Normalize floating point precision (keep 2 decimal places max)
// Use Locale.US to ensure decimal separator is always '.' (not ',' in some locales)
// Fixes GitHub issue #38: Locale-dependent decimal separator causing syntax errors
.replace(Regex("(\\d+\\.\\d{3,})f")) { matchResult ->
val number = matchResult.groupValues[1].toDouble()
String.format("%.2f", number) + "f"
String.format(Locale.US, "%.2f", number) + "f"
}
// Sort imports for consistency
.let { sortImportsIfNeeded(it) }
Expand Down