Skip to content

Commit

Permalink
Update to 3.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yannchevalier committed Apr 19, 2024
1 parent 0450d40 commit d394513
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
import com.myscript.iink.graphics.Style;
import com.myscript.iink.graphics.Transform;

import java.util.HashSet;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

public class Canvas implements ICanvas
{
Expand Down Expand Up @@ -80,7 +80,7 @@ public class Canvas implements ICanvas

private boolean clearOnStartDraw = true;

private final Set<String> clips;
private final List<String> clips;

private final Map<String, Typeface> typefaceMap;

Expand All @@ -104,7 +104,7 @@ public Canvas(@Nullable android.graphics.Canvas canvas, Map<String, Typeface> ty
this.xdpi = xdpi;
this.ydpi = ydpi;

clips = new HashSet<>();
clips = new ArrayList<String>();

strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
strokePaint.setStyle(Paint.Style.STROKE);
Expand Down Expand Up @@ -367,10 +367,12 @@ public void startGroup(@NonNull String id, float x, float y, float width, float
@Override
public void endGroup(@NonNull String id)
{
if (clips.remove(id))
int index = clips.lastIndexOf(id);
if (index != -1)
{
Objects.requireNonNull(canvas);
canvas.restore();
clips.remove(index);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.text.style.MetricAffectingSpan;
import android.text.style.TextAppearanceSpan;
import android.util.DisplayMetrics;
import android.util.TypedValue;

import androidx.annotation.NonNull;
import androidx.collection.LruCache;
Expand Down Expand Up @@ -88,11 +89,6 @@ public FontMetricsProvider(DisplayMetrics displayMetrics, Map<String, Typeface>
this.typefaceMap = typefaceMap;
}

private float x_mm2px(float mm)
{
return (mm / 25.4f) * displayMetrics.xdpi;
}

private float y_mm2px(float mm)
{
return (mm / 25.4f) * displayMetrics.ydpi;
Expand Down Expand Up @@ -127,7 +123,7 @@ public Rectangle[] getCharacterBoundingBoxes(@NonNull Text text, TextSpan[] span
@Override
public float getFontSizePx(Style style)
{
return style.getFontSize() * displayMetrics.scaledDensity;
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, style.getFontSize(), displayMetrics);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions samples/buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ object Versions {

// 3rd party
const val gson = "2.10.1"
const val okhttp = "4.11.0"
}
6 changes: 3 additions & 3 deletions samples/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

rootProject.name = 'myscript.iink.samples.android.java'

gradle.ext.iinkVersionCode = 2310
gradle.ext.iinkVersionName = "2.3.1"
gradle.ext.iinkResourcesURL = "https://download.myscript.com/iink/recognitionAssets_iink_2.3"
gradle.ext.iinkVersionCode = 3020
gradle.ext.iinkVersionName = "3.0.2"
gradle.ext.iinkResourcesURL = "https://download.myscript.com/iink/recognitionAssets_iink_3.0"

def projects = [
// samples
Expand Down

0 comments on commit d394513

Please sign in to comment.