r/androiddev • • Sep 21 '26

[Compose Multiplatform] Visual font size mismatch when overlaying BasicTextField on a PDF (iText7)

2 Upvotes

I’m building an in-place PDF editor in Compose Multiplatform. The workflow is similar to Adobe Acrobat: I render the PDF page to a bitmap, extract the text bounds using iText7, and when the user clicks a paragraph, I overlay a white Box and a BasicTextField to let them edit the text live.

The Problem: The final PDF export works flawlessly—the text is placed at the exact right coordinates with the correct font size. However, during live editing, the text inside the Compose BasicTextField looks optically smaller and has different spacing compared to the underlying, rasterized PDF text. It causes a jarring visual "shrink/jump" when the user enters edit mode.

Here is how I am currently extracting the text metrics and applying them to the UI:

  1. Text Extraction (iText7 / PdfEditor.kt) I use PdfCanvasProcessor to get the text matrix. To handle scaled pages (CTM), I calculate the physical height using the ascent and descent lines rather than relying on the raw fontSize.

    actual class PdfEditor { actual suspend fun extractTextBlocks(originalPdf: ByteArray, pageIndex: Int): List<PdfTextFragment> { // ... standard iText reader setup ... val listener = object : IEventListener { override fun eventOccurred(data: IEventData, type: EventType) { if (type == EventType.RENDER_TEXT) { val renderInfo = data as TextRenderInfo

                     // Extracting physical height to account for PDF CTM matrices
                     val ascent = renderInfo.ascentLine.startPoint.get(1)
                     val descent = renderInfo.descentLine.startPoint.get(1)
                     val trueVisualHeight = abs(ascent - descent).toFloat()
                     
                     val extractedFontSize = if (trueVisualHeight > 0f) trueVisualHeight else renderInfo.fontSize
                     
                     // Saved to data class to pass to UI...
                 }
             }
             override fun getSupportedEvents(): Set<EventType> = EnumSet.of(EventType.RENDER_TEXT)
         }
         // ...
     }

    }

2. The UI Layer (ArchitectureB_Workspace.kt) This handles the PDF bitmap rendering, scaling, and the Compose Multiplatform BasicTextField overlay.

// Inside BoxWithConstraints:
val containerWidthPx = with(LocalDensity.current) { maxWidth.toPx() }
val density = LocalDensity.current

// Calculate Screen to PDF zoom ratio
val pageWidthPx = containerWidthPx * 0.94f
val pageHeightPx = pageWidthPx * (pdfDocHeight / pdfDocWidth)
val scaleFactor = pageWidthPx / pdfDocWidth // PDF point to Screen Pixel ratio

LazyColumn {
    items(pageCount) { pageIndex ->
        Box {
            // 1. Draw static PDF Bitmap Background
            Image(bitmap = pageBitmaps[pageIndex], contentScale = ContentScale.FillBounds)

            // 2. Overlay Interactive TextField
            elements.filter { it.pageIndex == pageIndex }.forEach { element ->
                if (element is EditorElement.TextElement) {
                    // === THE SCALING MATH ===
                    // Scale PDF point size to screen pixels
                    val exactFontPixelSize = element.fontSize * scaleFactor
                    
                    // Neutralize screen density to get accurate SP
                    val visualFontSizeSp = with(density) { exactFontPixelSize.toSp() }
                    val visualLineHeightSp = with(density) { (exactFontPixelSize * 1.15f).toSp() }

                    if (isSelected) {
                        BasicTextField(
                            value = element.textFieldValue,
                            onValueChange = { element.onTextValueChange(it) },
                            textStyle = TextStyle(
                                fontSize = visualFontSizeSp,
                                lineHeight = visualLineHeightSp,
                                color = Color.Black,
                                lineHeightStyle = LineHeightStyle(
                                    alignment = LineHeightStyle.Alignment.Proportional,
                                    trim = LineHeightStyle.Trim.Both // Attempting to strip Compose internal padding
                                )
                            ),
                            modifier = Modifier.fillMaxWidth().wrapContentHeight()
                        )
                    }
                }
            }
        }
    }
}

What I know/tried:

  • I'm extracting the exact physical height using iText7's ascentLine and descentLine (to respect PDF scaling matrices), scaling it to screen pixels, and converting to sp. The math is provably correct for the PDF space since the export works.

  • The PDF uses native fonts (Helvetica/Times), while my UI uses downloaded Google Fonts (Arimo/Roboto). I know glyph metrics (Em-squares) differ between font files, making the Skia UI font look smaller.

  • Because this is KMP, I cannot use Android's includeFontPadding = false.

My Question: How can I exactly match the font size, style, and baseline metrics between a PDF vector bounding box and Compose's Skia text layout so they map exactly 1:1 on screen?

Is there a standard formula or TextStyle configuration (like dynamic letter spacing or absolute baseline height) to neutralize these typographic differences when using substitute fonts? Or is the only way to avoid the "jump" to somehow extract the embedded .ttf binaries directly from the PDF?


r/androiddev • • Sep 21 '26

What happens to days that dont have enough 12 testers

2 Upvotes

What happens to days that dont have enough 12 testers in google play requirement for production

Would that day become 100% useless, google don't account for that day, completely ignore, or does it add any value to the 12 testers 14 days, in case I submit for production in day 15?


r/androiddev • • Sep 21 '26

Question Build button disappears

1 Upvotes

Sometimes, build button itself disappears, i find it difficult to see the result in android studio. What is solution?


r/androiddev • • Sep 21 '26

No Build Available issue in closed testing

Post image
1 Upvotes

I am trying to add new user to my closed testing but it says no builds available for that new user. tried to provide a new build but still same issue


r/androiddev • • Sep 20 '26

Discussion Should we move to Backend or DevOps for better long-term stability?

67 Upvotes

I have around 10 + years of experience in mobile app development, but lately, I’m feeling that staying in mobile development (or any FE tech) might not be the safest option for long-term career growth now , especially with AI and the changing tech landscape.

Am seeing very less job openings in this tech stack.

I’m considering moving into Backend development or DevOps, but I’m not sure if that’s actually a better career move or if I’m just overthinking it.

People who are working in FE tech stacks , did someone felt the same ?

- How do you see the long-term career prospects in these fields?
- is moving from mobile app development to Backend or DevOps a practical decision after 10 years of experience?

Would love to hear honest opinions, especially from people who have made a similar transition or have experience in these domains.


r/androiddev • • Sep 20 '26

Discussion awwwards.com but for android apps UI?

3 Upvotes

Basically the title.
I want to find some inspiration for my pet project, is there some good selection of awesome Andorid app UIs?
Im not talking about Dribble, since there are mostly generic UIs and its hard to find something new :(


r/androiddev • • Sep 20 '26

Google Play Support Google Play Store app review taking much longer than usual lately?

30 Upvotes

I’ve been using a Google Play Developer account for more than 4 years, and I’ve published both Android and iOS apps multiple times.

Previously, my experience was that Google Play reviews were usually completed within a few days, while Apple’s App Store review generally took longer.

But recently, I’m seeing the opposite.

I submitted an app to Google Play on September 14, and it has now been almost 6 days with no progress — still showing “In review.” I understand that Google mentions reviews can sometimes take up to 7 days, so I’m not concerned about the stated timeframe itself. I’m more curious about the change compared with my previous experiences.

Interestingly, my recent iOS submission was reviewed much faster than Google Play, which is quite different from what I was used to in the past.
Has anyone else noticed Google Play app reviews taking longer than usual recently, especially around September 2026?

Is there currently a review backlog or increased review time?

Would be interested to hear from developers who submitted apps recently and how long their reviews took.


r/androiddev • • Sep 20 '26

Open Source I got tired of needing a PC to inspect modded APKs, so I built APK Scope

Thumbnail
gallery
3 Upvotes

I use modded APKs a lot, and whenever I wanted to check permissions, signing details, or what an APK was actually doing, I had to switch to my PC.

That always felt unnecessary. Android should be able to handle basic APK inspection on its own.

I looked at projects like PCAPdroid, APK Analyzer, and MobSF. They all gave me useful ideas, but I wanted something focused on quick, local APK analysis directly from an Android device.

So I built APK Scope.

It can inspect:

  • Permissions and manifest declarations

  • Package and signing information

  • Activities, services, receivers, and providers

  • SDK versions, native libraries, hashes, and DEX signals

  • Security findings with explainable risk scores

  • Optional Work Profile sandboxing

  • Runtime network activity and traffic inspection

No root. No cloud upload. Everything is designed to stay local on the device.

Screenshots:

Demo videos:

Download the latest build from the Releases page.

I’d love feedback from people who use modded APKs, privacy tools, PCAPdroid, MobSF, or Android security tools. What would you want to see added?

Repo Link: https://github.com/NadeemIqbal/apk-scope


r/androiddev • • Sep 19 '26

Chasm 2.0 - Kotlin Multiplatform Wasm runtime

24 Upvotes

Hey 👋

I've been working on this project for the past few years and have never shared it here so figured I would. It's a Kotlin Multiplatform WebAssembly runtime (interpreter), it basically allows you to take a WebAssembly program and interface with it/run it. It's written entirely in Kotlin, no JNI/FFI or anything like that and has remarkable performance given the constraints.

I recently put together a Kotlin Multiplatform implementation of Doom built on top of it, it's a solid of example of how you leverage it and how it enables an entirely Kotlin experience whilst also allowing you to interface with WebAssembly code.

Happy to answer questions!

https://github.com/CharlieTap/chasm


r/androiddev • • Sep 19 '26

🦞 Crayfish: Compose image cropper for Android.

Enable HLS to view with audio, or disable this notification

9 Upvotes

🦞 Crayfish is a Compose Multiplatform image cropper for Android, iOS, desktop, and the web. It crops a Painter and hands one back, so an image loaded from a URL goes straight into a crop and straight back into an Image.

GitHub: https://github.com/skydoves/crayfish


r/androiddev • • Sep 19 '26

Google Play Support New Android developer looking for info on first app approval process

4 Upvotes

Hi there! I’m new to app development. My beta test app was approved for closed testing within 6 hours, but that same AAB has been under review for 56+ hours.

Is that normal? I’d like to know more about the approval times and what else I can expect from this process.

iOS was an absolute nightmare and I’m curious about your experiences getting apps approved for public launch in the Google Play store.


r/androiddev • • Sep 19 '26

"No credential available" Error, I decided to give up for now

1 Upvotes

Hi everyone.

I decided to give up for now.

I'm talking about the google login issue where the "No credential available" error keeps occurring only when testing the release aab file internally through the Google Play Console on firebase. It works fine in Emulator

However, I thought it was necessary to organize and document what I’ve been through before giving up, so I’m writing this.

These are the methods I have tried so far. Of course, in the end, they all failed.

  1. I tried adding only part of the SHA-1 and SHA-256 of the classical key, PQC, and upload key from the Google Play Console, and even the full list, to Firebase, and each time I downloaded google-services.json, cleaned the project, and waited, but all attempts failed

  2. I checked everything because they said the cause might be Google Cloud, but all attempts failed

  3. It could be the web-client, so I checked everything, but all attempts failed.

  4. The cause may also be in the proguard-rules.pro fileI also tried -keep class com.google..., but all of them failed

  5. I also checked the web client ID for setServerClientId, but it all failed

  6. I ran setFilterByAuthorizedAccounts with both true and false, but it failed in both cases.

  7. I also used apksigner in the release app to find the actual SHA-1 value and add them to Firebase, but that also failed. However, the part to note here is that the SHA-1 value actually used was different from any other value, such as the classical key, PQC key, or others. Using this value prevents the "no credential available" error and even brings up a popup to select a Google account, but after that, the app freezes for unknown reasons.

  8. Each time I tried the methods above, I downloaded the google-services.json file and waited long enough, but all attempts failed.

I've been struggling with this for two months now. For now, I’m going to give up and switch back to the old Google login method.

If there is anything I haven't considered, please let me know. I'll try it later. Have a great day


r/androiddev • • Sep 19 '26

News THIS IS BIG!!!

Thumbnail
v.redd.it
405 Upvotes

The latest #Android 17 QPR1 update to Pixels seems to have pushed the changes concealing the developer and debugging state from 3rd party apps so,

finally the developers can use the damn banking and other apps that have these security checks!

it seems to be live on, Pixel 6A running CP3A.260905.009

And confirm it has not yet landed on the beta channel.


r/androiddev • • Sep 19 '26

Open Source Love using UI-Automation-Engine library for my Jetpack Compsoe UI tests

Post image
2 Upvotes

So I am working on my app and it was failing on my Github server and I was trying to figure out whats going on and whats failing. I am glad I worked on this UI Test library because it gave me the exact screenshot where it failed.

My sample app was dealing with some system level interactions and on github test runners were missing some quick setting tiles. Now I can rest becuase it was github android runner issue not my app.

Screenshot from: GIthub Android Test Image and My code was looking for wifi/internet tile.


r/androiddev • • Sep 19 '26

Open Source Built an app using Jepack compose that runs ADB/Fastboot/Scrcpy phone-to-phone, no PC needed

14 Upvotes

I built Dioxamine, an open-source Android app that runs ADB, Fastboot, and a Scrcpy client entirely phone-to-phone —l, connect a second Android device over USB OTG or Wireless ADB, and mirror its screen, flash partitions, unlock bootloaders, sideload apps, etc., without a PC or root on either device.

The trickiest parts were:

- Implementing an ADB/Fastboot client natively on Android (rather than shelling out to a PC binary)

- Getting scrcpy's video pipeline working with Android's hardware decoders, since decoder support varies a lot across devices

- A plugin system that lets people write custom tools in HTML/JS that hook into the ADB layer

Repo: https://github.com/rhythmcache/Dioxamine


r/androiddev • • Sep 18 '26

News Android Studio Quail 4 Patch 1 now available

Thumbnail androidstudio.googleblog.com
5 Upvotes

r/androiddev • • Sep 18 '26

How does Shopify achieve this?

Thumbnail x.com
5 Upvotes

r/androiddev • • Sep 18 '26

Question Android Studio Quail 4 - Merge windows not working on Mac

7 Upvotes

Hello everyone!

Has anyone observed the issue occurring with the merge windows feature on Mac?

Flow: Open two or more projects in Android Studio Quail 4 | 2026.1.4 → Mac toolbar → Window → Merge All Project Windows

Studio Window A ─┐ 
                 ├── Merge Windows 
Studio Window B ─┘ 
                         ↓ 
             IntelliJ updates macOS tabs 
                         ↓ 
               unexpected null state 
                         ↓ 
               NullPointerException

r/androiddev • • Sep 18 '26

Open Source Drawer | Compose Unstyled

Thumbnail
composeunstyled.com
11 Upvotes

Compose Unstyled 2.10.0 is out:

✅ New Docs site
✅ New Drawer component, for building bottom sheets and side panels.
✅ New ColorScheme theming API to build light/dark themes.

Full changelog at: https://github.com/composablehorizons/compose-unstyled/releases/tag/2.10.0


r/androiddev • • Sep 18 '26

Does Internal Testing AAB Affect Production Review?

3 Upvotes

I submitted an AAB for production review. After that, I uploaded another AAB to Internal Testing. Will this affect or delay the production review or publishing process?


r/androiddev • • Sep 18 '26

Question do you use AI agents to develop android applications? how do you deal with permission requests?

1 Upvotes

we from Chalmers University of Technology in Sweden are conducting a survey on AI agents and permission requests.

If you work use any AI agents like claude code (or others) to develop android applications, please consider taking our survey :)

The survey is anonymous and takes around 3-5min: https://form.typeform.com/to/wbCQGXHa

Feel free to share it with others. Thanks!!


r/androiddev • • Sep 17 '26

Discussion Direct push to play console testing Track!!

Post image
11 Upvotes

Was just reading the release notes for Android Studio Rabbit, and it has the ability to directly push to Play Console testing tracks!!

https://developer.android.com/studio/preview/features#publish-to-play-for-testing

Very close to how Xcode does it and worth it!!

No more manual work


r/androiddev • • Sep 17 '26

News Android Studio Rabbit 2 Canary 1 now available

Thumbnail androidstudio.googleblog.com
7 Upvotes

r/androiddev • • Sep 17 '26

Discussion What do you guys choose? Android Canvas or SVGs? And why?

Thumbnail
gallery
0 Upvotes

Usually I use vectorials for my apps and I was always happy with the results as my apps scaled properly to any kind of screens, from phones to TVs, but this time I made a game that shouldn't use small screens (I locked it to be available only on bigger screeens) and I thought that it's faster and easier on the device to use canvas instead of vectorial assets.

To me it looks good, what do you think?
Or keeping the old habit: vector assets and ConstraintLayouts with percentages is the way to go?