Skip to content

Commit 812c0ab

Browse files
committed
[lib] Removed unused methods from clusters utility class
1 parent 5bfb781 commit 812c0ab

File tree

1 file changed

+1
-80
lines changed
  • tehreer-android/src/main/java/com/mta/tehreer/internal/util

1 file changed

+1
-80
lines changed

tehreer-android/src/main/java/com/mta/tehreer/internal/util/Clusters.java

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018 Muhammad Tayyab Akram
2+
* Copyright (C) 2018-2019 Muhammad Tayyab Akram
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,85 +21,6 @@
2121
import com.mta.tehreer.collections.IntList;
2222

2323
public final class Clusters {
24-
public static void loadCharExtents(@NonNull int[] clusterMap,
25-
boolean isBackward, boolean visuallyRTL,
26-
@NonNull int[] glyphIds, @NonNull float[] glyphAdvances,
27-
@NonNull float[] charExtents) {
28-
if (!isBackward) {
29-
loadForwardExtents(clusterMap, visuallyRTL, glyphIds, glyphAdvances, charExtents);
30-
} else {
31-
loadBackwardExtents(clusterMap, visuallyRTL, glyphIds, glyphAdvances, charExtents);
32-
}
33-
}
34-
35-
private static void loadForwardExtents(@NonNull int[] clusterMap, boolean visuallyRTL,
36-
@NonNull int[] glyphIds, @NonNull float[] glyphAdvances,
37-
@NonNull float[] charExtents) {
38-
int clusterStart = 0;
39-
int runLength = clusterMap.length;
40-
41-
int glyphStart = clusterMap[0];
42-
float distance = 0.0f;
43-
44-
for (int i = 0; i <= runLength; i++) {
45-
int glyphIndex = (i < runLength ? clusterMap[i] : glyphIds.length);
46-
if (glyphIndex == glyphStart) {
47-
continue;
48-
}
49-
50-
// Find the advance of current cluster.
51-
float clusterAdvance = 0.0f;
52-
for (int j = glyphStart; j < glyphIndex; j++) {
53-
clusterAdvance += glyphAdvances[j];
54-
}
55-
56-
// Divide the advance evenly between cluster length.
57-
int clusterLength = i - clusterStart;
58-
float charAdvance = clusterAdvance / clusterLength;
59-
60-
for (int j = clusterStart; j < i; j++) {
61-
distance += (visuallyRTL ? -charAdvance : charAdvance);
62-
charExtents[j] = distance;
63-
}
64-
65-
clusterStart = i;
66-
glyphStart = glyphIndex;
67-
}
68-
}
69-
70-
private static void loadBackwardExtents(@NonNull int[] clusterMap, boolean visuallyRTL,
71-
@NonNull int[] glyphIds, @NonNull float[] glyphAdvances,
72-
@NonNull float[] charExtents) {
73-
int clusterEnd = clusterMap.length;
74-
int glyphStart = clusterMap[clusterEnd - 1];
75-
float distance = 0.0f;
76-
77-
for (int i = clusterEnd; i >= 0; i--) {
78-
int glyphIndex = (i > 0 ? clusterMap[i - 1] : glyphIds.length);
79-
if (glyphIndex == glyphStart) {
80-
continue;
81-
}
82-
83-
// Find the advance of current cluster.
84-
float clusterAdvance = 0.0f;
85-
for (int j = glyphStart; j < glyphIndex; j++) {
86-
clusterAdvance += glyphAdvances[j];
87-
}
88-
89-
// Divide the advance evenly between cluster length.
90-
int clusterLength = clusterEnd - i;
91-
float charAdvance = clusterAdvance / clusterLength;
92-
93-
for (int j = clusterEnd; j > i; j--) {
94-
distance += (visuallyRTL ? charAdvance : -charAdvance);
95-
charExtents[j - 1] = distance;
96-
}
97-
98-
clusterEnd = i;
99-
glyphStart = glyphIndex;
100-
}
101-
}
102-
10324
public static void loadGlyphRange(@NonNull int[] clusterMap, int startIndex, int endIndex,
10425
boolean isBackward, int glyphCount, @NonNull int[] glyphRange) {
10526
if (!isBackward) {

0 commit comments

Comments
 (0)