#220 Adding characters to font

Displaying font info
This commit is contained in:
Jindra Petk
2013-07-10 17:31:53 +02:00
parent 4e997b5279
commit d3c8ce808a
12 changed files with 541 additions and 164 deletions

View File

@@ -431,9 +431,6 @@ public class SWFOutputStream extends OutputStream {
* @return Number of bits
*/
public static int getNeededBitsS(int v) {
/*if (v == 0) {
//return 0;
}*/
int counter = 32;
int mask = 0x80000000;
final int val = (v < 0) ? -v : v;
@@ -444,6 +441,22 @@ public class SWFOutputStream extends OutputStream {
return counter + 1;
}
/**
* Calculates number of bits needed for representing signed values
*
* @param first First Signed value
* @param params Next Signed values
* @return Number of bits
*/
public static int getNeededBitsS(int first, int... params) {
int nBits = 0;
nBits = enlargeBitCountS(nBits, first);
for (int i = 0; i < params.length; i++) {
nBits = enlargeBitCountS(nBits, params[i]);
}
return nBits;
}
private static long getIntPart(double value) {
if (value < 0) {
return (long) Math.ceil(value);
@@ -478,7 +491,7 @@ public class SWFOutputStream extends OutputStream {
return getNeededBitsS(k) + 16;
}
private int enlargeBitCountS(int currentBitCount, int value) {
private static int enlargeBitCountS(int currentBitCount, int value) {
int neededNew = getNeededBitsS(value);
if (neededNew > currentBitCount) {
return neededNew;