Skip to content

feat: text metrics (DasherCore v0.2.4) + version line (RFC 0016) - #19

Merged
willwade merged 2 commits into
mainfrom
feat/version-in-privacy
Aug 22, 2026
Merged

feat: text metrics (DasherCore v0.2.4) + version line (RFC 0016)#19
willwade merged 2 commits into
mainfrom
feat/version-in-privacy

Conversation

@willwade

Copy link
Copy Markdown
Contributor

Supersedes #16 (squash-merged into its stacked base by mistake) and #18 (auto-closed by the same). One PR, two commits, net diff identical to those two combined.

1. Real text metrics for label layout (DasherCore #56 / v0.2.4)

The engine laid out node labels using a codepoints × fontSize/2 estimate whose error compounds down the label shunting chain — deep-zoom text degenerates into jumbles (user-visible on Windows; same engine path here). Wires dasher_set_text_size_callback end to end:

  • JNI textSizeCallback marshals into NativeBridge.onTextSize (same cached-methodID pattern as the other callbacks); new nativeSetTextSizeCallback / nativeTextMetricsChanged.
  • DasherCanvasView.measureGlyphText measures with the same Paint + size transform (×2.5, floor 8) the canvas draws opcode-5 text with, so layout and drawing agree; font changes invalidate cached metrics.
  • MainActivity and the IME install their own measurement (static listeners — the IME must not inherit the Activity's canvas).
  • Submodule → DasherCore v0.2.4.

2. App version line in Settings → Privacy (RFC 0016, fixes #17)

Quiet Dasher <version> line reading AnalyticsService.appVersion (BuildConfig.VERSION_NAME) — same value analytics reports; UI and telemetry cannot disagree.

Testing

:app:compileDebugKotlin, :app:testDebugUnitTest, :app:assembleDebug (native vs v0.2.4, arm64-v8a + x86_64) green locally; CI green on the superseded PRs (same code).

DCO signed (both commits carried it).

… #56)

Bumps third_party/DasherCore to v0.2.4 and wires the text-size
callback: the engine measures labels with the same Paint (typeface +
size transform) the canvas draws opcode-5 text with, replacing the
codepoints x size/2 estimate whose error compounds down the label
chain and jumbles deep-zoom text.

- jni_bridge: textSizeCallback marshals into Kotlin
  NativeBridge.onTextSize (same cached-methodID pattern as the other
  engine callbacks); nativeSetTextSizeCallback /
  nativeTextMetricsChanged bindings.
- DasherCanvasView.measureGlyphText applies the canvas's exact opcode-5
  size transform (x2.5, floored at 8) so measurement and drawing agree;
  glyphFontName changes fire textMetricsChanged.
- MainActivity and the IME both install their own measurement (the
  NativeBridge listener is static, so the IME must not inherit the
  Activity's canvas).

Signed-off-by: will wade <willwade@gmail.com>
One quiet 'Dasher <version>' line at the bottom of Settings ->
Privacy, reading AnalyticsService.appVersion (BuildConfig.VERSION_NAME)
- the same value analytics already reports, so UI and telemetry cannot
disagree. appVersion() collapses into a public val as the single source.

Interim home pending the About section (RFC 0006).

Fixes #17.

Signed-off-by: will wade <willwade@gmail.com>
@willwade
willwade force-pushed the feat/version-in-privacy branch from 7e00d45 to 3ef3444 Compare August 22, 2026 09:22
@willwade
willwade merged commit fb51093 into main Aug 22, 2026
2 checks passed
@willwade
willwade deleted the feat/version-in-privacy branch August 22, 2026 09:33
willwade added a commit to dasher-project/Dasher-Apple that referenced this pull request Aug 24, 2026
Fixes #35.

## What
- `AnalyticsPrivacySection` footer gains a plain `Dasher <version>` line
— shown on iOS, macOS and visionOS (every target that renders the shared
Privacy section)
- New `AnalyticsService.displayVersion` (public static) reads
`CFBundleShortVersionString`; the private `appVersion` used by analytics
events now routes through it, so **the UI line and telemetry share one
constant by construction**

## Why
Per [RFC
0016](https://github.com/dasher-project/governance/blob/main/rfcs/0016-version-in-settings.md):
support triage needs the build version without asking users to guess
(packaged installs often can't tell). Interim placement in Privacy until
RFC 0006's About section exists.

Mirrors [Dasher-Android
#19](dasher-project/Dasher-Android#19) and
[Dasher-GTK #55](dasher-project/Dasher-GTK#55).

## Verification
- `xcodebuild -scheme DasherMac` (CI gate): BUILD SUCCEEDED, 0 errors
- By construction: shown string == `app_version` in analytics events

Signed-off-by: will wade <willwade@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC 0016: show the app version in Settings (Privacy tab for now)

1 participant