AppDimens.Net.Resize
3.6.0
dotnet add package AppDimens.Net.Resize --version 3.6.0
NuGet\Install-Package AppDimens.Net.Resize -Version 3.6.0
<PackageReference Include="AppDimens.Net.Resize" Version="3.6.0" />
<PackageVersion Include="AppDimens.Net.Resize" Version="3.6.0" />
<PackageReference Include="AppDimens.Net.Resize" />
paket add AppDimens.Net.Resize --version 3.6.0
#r "nuget: AppDimens.Net.Resize, 3.6.0"
#:package AppDimens.Net.Resize@3.6.0
#addin nuget:?package=AppDimens.Net.Resize&version=3.6.0
#tool nuget:?package=AppDimens.Net.Resize&version=3.6.0
<div align="center">
🔠 AppDimens.Net.Resize
Auto-resize math — fit text and squares into boxes with bounded step search.
Part of the AppDimens for .NET family · requires AppDimens.Net (core).
</div>
🎯 What is it?
The Resize module solves the "shrink-to-fit" problem: given a box and content, find the largest font size or square side that still fits — using pre-computed bounded step ranges (≤ 4096 steps) and binary search instead of guess-and-check layout loops.
📦 Installation
dotnet add package AppDimens.Net.Resize
Depends on AppDimens.Net (pulled automatically). Attach a MAUI window first or pass an explicit
IAppDimensContext.
🚀 Quick start
using AppDimens.Net.Resize;
// Largest font (in px) that fits the headline into its box
float fontPx = DimenResize.AutoResizeTextPx(
text: title, boxWidthPx: boxW,
minSp: 14, maxSp: 48, stepSp: 1f,
maxLines: 2);
// MAUI FontSize expects device-independent units:
label.FontSize = fontPx / ctx.Density; // ÷ density · fontScale for sp semantics
// Largest square badge that fits a box (result already in dp)
float sideDp = DimenResize.AutoResizeSquarePx(boxWpx, boxHpx, minDp: 16, maxDp: 96, stepDp: 2f);
🧭 API
| Member | Purpose |
|---|---|
ResizeRangePx(minPx, maxPx, stepPx) |
bounded candidate range (≤ 4096 steps) |
ResizeMath.BuildStepsPx(...) |
sorted step array generation |
ResizeMath.FindLargestFitting(steps, fits) |
binary search for the largest passing step |
DimenResize.AutoResizeTextPx(text, boxWidthPx, minSp, maxSp, stepSp, maxLines, ctx) |
fitting font size (px) |
DimenResize.AutoResizeSquarePx(boxWpx, boxHpx, minDp, maxDp, stepDp, ctx) |
fitting square side (dp) |
DimenResize.InnerMaxDimensionsPx(...) |
usable inner box size |
DimenResize.PercentOfBoxToFactor(percent) |
% of box → scale factor |
DimenResize.ResolveFixed(valueDp, asSp, ctx) |
plain dp/sp resolution helper |
⚠️
AutoResizeTextPxreturns pixels; divide bydensity(andfontScalefor sp) before assigning to MAUIFontSize.
💡 When to use
| Scenario | Recommendation |
|---|---|
| Headlines/badges inside fixed boxes | ✅ Resize |
| Everything else scales responsively | core Scaled strategy |
⚡ Performance
Step arrays are cached per configuration snapshot; resize changes invalidate automatically via the event watcher — no manual clearing.
📚 Full package family
AppDimens.Net · Percent · Power · Auto · Logarithmic · Fluid · Interpolated · Diagonal · Perimeter · Fill · Fit · Density · Units · Maui · Sdk meta-package
Apache-2.0 — © Jean Bodenberg · Repository · Formulas are bit-a-bit ports of appdimens-kmp
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- AppDimens.Net (>= 3.6.0)
-
net8.0
- AppDimens.Net (>= 3.6.0)
-
net9.0
- AppDimens.Net (>= 3.6.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AppDimens.Net.Resize:
| Package | Downloads |
|---|---|
|
AppDimens.Net.Sdk
AppDimens .NET meta-package ("BOM"): pulls the principal library plus every strategy module with a single reference. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.6.0 | 98 | 8/23/2026 |