Skip to content

Migrate to woff2 fonts with woff2ttf decoder#908

Merged
egorikftp merged 1 commit intomainfrom
feature/migrate-to-woff2
Feb 27, 2026
Merged

Migrate to woff2 fonts with woff2ttf decoder#908
egorikftp merged 1 commit intomainfrom
feature/migrate-to-woff2

Conversation

@egorikftp
Copy link
Copy Markdown
Member


📝 Changelog

If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs:

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 27, 2026

Walkthrough

This pull request switches icon font sources to WOFF2 and decodes them to TTF when downloaded. MaterialFontRepository now decodes downloaded WOFF2 bytes; three MaterialIconFontFamily CDN URLs were changed from .ttf to .woff2 (Outlined, Rounded, Sharp); LucideRepository now fetches lucide.woff2 and decodes it to TTF. Public classes and method signatures remain unchanged.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: migrating to WOFF2 fonts with a decoder for TTF conversion.
Description check ✅ Passed The description includes the linked issue reference (#859) and follows the changelog template with the required checklist items.
Linked Issues check ✅ Passed The code changes successfully implement the requirements: WOFF2 fonts are now used for Material Symbols and Lucide icon providers with proper WOFF2→TTF decoding logic.
Out of Scope Changes check ✅ Passed All changes are directly related to migrating font sources to WOFF2 and implementing the necessary decoding logic; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/migrate-to-woff2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@egorikftp egorikftp force-pushed the feature/migrate-to-woff2 branch from fd2b19d to 15af299 Compare February 27, 2026 10:29
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tools/idea-plugin/CHANGELOG.md`:
- Line 17: Fix the typo in the changelog entry string "- [Web Import] Forse
`Material Symbols` and `Lucide` icons providers to use woff2 font" by changing
"Forse" to "Force" and update "icons providers" to "icon providers" so the line
reads "- [Web Import] Force `Material Symbols` and `Lucide` icon providers to
use woff2 font"; edit the CHANGELOG.md entry containing that exact text.

In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideRepository.kt`:
- Around line 48-53: The cached fontBytesCache is being returned by reference
(from the block that fetches via
httpClient.get(FONT_URL).bodyAsChannel().toByteArray() and decodes with
Woff2Decoder.decodeBytes), which allows callers to mutate the shared ByteArray;
fix by storing a defensive copy into fontBytesCache and always returning a copy
to callers (i.e., after decoding ttfBytes make fontBytesCache =
ttfBytes.copyOf() and return fontBytesCache.copyOf()), so neither the stored
cache nor subsequent callers can be mutated externally.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd2b19d and 15af299.

📒 Files selected for processing (4)
  • tools/idea-plugin/CHANGELOG.md
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/material/data/font/MaterialFontRepository.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/material/domain/model/font/MaterialIconFontFamily.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideRepository.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/material/domain/model/font/MaterialIconFontFamily.kt

Comment thread tools/idea-plugin/CHANGELOG.md Outdated
@egorikftp egorikftp force-pushed the feature/migrate-to-woff2 branch from 15af299 to 18d5117 Compare February 27, 2026 10:37
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/material/data/font/MaterialFontRepository.kt (1)

17-20: Split network I/O and decode CPU work across dispatchers.

downloadFont currently performs both fetch and decode on Dispatchers.IO. Consider decoding on Dispatchers.Default to avoid saturating I/O threads during bulk imports.

Proposed refactor
 suspend fun downloadFont(url: String): ByteArray = withContext(Dispatchers.IO) {
-    val woff2Bytes = httpClient.get(url).bodyAsChannel().toByteArray()
-
-    Woff2Decoder.decodeBytes(woff2Bytes) ?: error("Failed to decode WOFF2 font")
+    val woff2Bytes = httpClient.get(url).bodyAsChannel().toByteArray()
+    withContext(Dispatchers.Default) {
+        Woff2Decoder.decodeBytes(woff2Bytes) ?: error("Failed to decode WOFF2 font")
+    }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/material/data/font/MaterialFontRepository.kt`
around lines 17 - 20, downloadFont currently performs both network I/O and
CPU-heavy WOFF2 decoding on Dispatchers.IO; change it to fetch the bytes on
Dispatchers.IO (keep the httpClient.get(...).bodyAsChannel().toByteArray() call
there) then switch to Dispatchers.Default for the
Woff2Decoder.decodeBytes(woff2Bytes) call and any subsequent processing,
returning the decoded ByteArray or throwing the same error on failure. Ensure
you use withContext(Dispatchers.Default) around the decode step so only the I/O
portion runs on IO threads and the decode runs on Default.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/material/data/font/MaterialFontRepository.kt`:
- Around line 17-20: downloadFont currently performs both network I/O and
CPU-heavy WOFF2 decoding on Dispatchers.IO; change it to fetch the bytes on
Dispatchers.IO (keep the httpClient.get(...).bodyAsChannel().toByteArray() call
there) then switch to Dispatchers.Default for the
Woff2Decoder.decodeBytes(woff2Bytes) call and any subsequent processing,
returning the decoded ByteArray or throwing the same error on failure. Ensure
you use withContext(Dispatchers.Default) around the decode step so only the I/O
portion runs on IO threads and the decode runs on Default.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 15af299 and 18d5117.

📒 Files selected for processing (4)
  • tools/idea-plugin/CHANGELOG.md
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/material/data/font/MaterialFontRepository.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/material/domain/model/font/MaterialIconFontFamily.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideRepository.kt
🚧 Files skipped from review as they are similar to previous changes (2)
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/material/domain/model/font/MaterialIconFontFamily.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideRepository.kt

@egorikftp egorikftp merged commit 57c35d0 into main Feb 27, 2026
3 checks passed
@egorikftp egorikftp deleted the feature/migrate-to-woff2 branch February 27, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[IntelliJ] Switch to woff2 for icons providers

2 participants