mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-15 19:29:45 +00:00
check font
This commit is contained in:
parent
ccc57c6bb6
commit
c40ac67be9
|
@ -66,6 +66,16 @@ public class FontFile extends AbstractFile
|
||||||
return text.toString ();
|
return text.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isFont (byte[] buffer)
|
||||||
|
{
|
||||||
|
if (buffer.length % 8 != 0)
|
||||||
|
return false;
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
if (buffer[i] != 0 && buffer[i] != 0x7F)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
class Character
|
class Character
|
||||||
{
|
{
|
||||||
String[] lines = new String[8];
|
String[] lines = new String[8];
|
||||||
|
|
|
@ -197,9 +197,9 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
||||||
exactBuffer = new byte[buffer.length - 4]; // reported length is too long
|
exactBuffer = new byte[buffer.length - 4]; // reported length is too long
|
||||||
|
|
||||||
System.arraycopy (buffer, 4, exactBuffer, 0, exactBuffer.length);
|
System.arraycopy (buffer, 4, exactBuffer, 0, exactBuffer.length);
|
||||||
|
if ((name.endsWith (".FONT") || name.endsWith (" FONT")
|
||||||
if (name.endsWith (".FONT") || name.endsWith (" FONT") || name.endsWith (".SET")
|
|| name.endsWith (".SET") || name.startsWith ("ASCII."))
|
||||||
|| name.startsWith ("ASCII."))
|
&& FontFile.isFont (exactBuffer))
|
||||||
appleFile = new FontFile (name, exactBuffer);
|
appleFile = new FontFile (name, exactBuffer);
|
||||||
else if (ShapeTable.isShapeTable (exactBuffer))
|
else if (ShapeTable.isShapeTable (exactBuffer))
|
||||||
appleFile = new ShapeTable (name, exactBuffer);
|
appleFile = new ShapeTable (name, exactBuffer);
|
||||||
|
|
|
@ -7,8 +7,6 @@ class Condition extends AbstractValue implements Iterable<Value>
|
||||||
{
|
{
|
||||||
private static final String[] comparators = { "<>", "<=", ">=", "=", "<", ">" };
|
private static final String[] comparators = { "<>", "<=", ">=", "=", "<", ">" };
|
||||||
|
|
||||||
private final Sheet parent;
|
|
||||||
|
|
||||||
private String comparator;
|
private String comparator;
|
||||||
private String conditionText;
|
private String conditionText;
|
||||||
private String valueText;
|
private String valueText;
|
||||||
|
@ -17,10 +15,9 @@ class Condition extends AbstractValue implements Iterable<Value>
|
||||||
private Expression conditionExpression;
|
private Expression conditionExpression;
|
||||||
private Expression valueExpression;
|
private Expression valueExpression;
|
||||||
|
|
||||||
public Condition (Sheet parent, Cell cell, String text)
|
public Condition (Cell cell, String text)
|
||||||
{
|
{
|
||||||
super ("Cond");
|
super ("Cond");
|
||||||
this.parent = parent;
|
|
||||||
fullText = text;
|
fullText = text;
|
||||||
|
|
||||||
for (String comp : comparators)
|
for (String comp : comparators)
|
||||||
|
|
|
@ -6,17 +6,17 @@ import java.util.List;
|
||||||
|
|
||||||
public class ConditionList implements Iterable<Condition>
|
public class ConditionList implements Iterable<Condition>
|
||||||
{
|
{
|
||||||
protected final List<Condition> conditions = new ArrayList<Condition> ();
|
private final List<Condition> conditions = new ArrayList<Condition> ();
|
||||||
|
|
||||||
public ConditionList (Cell cell, String text)
|
public ConditionList (Cell cell, String text)
|
||||||
{
|
{
|
||||||
Sheet parent = cell.getParent ();
|
// Sheet parent = cell.getParent ();
|
||||||
String remainder = text;
|
String remainder = text;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
String parameter = Expression.getParameter (remainder);
|
String parameter = Expression.getParameter (remainder);
|
||||||
conditions.add (new Condition (parent, cell, parameter));
|
conditions.add (new Condition (cell, parameter));
|
||||||
if (remainder.length () == parameter.length ())
|
if (remainder.length () == parameter.length ())
|
||||||
break;
|
break;
|
||||||
remainder = remainder.substring (parameter.length () + 1);
|
remainder = remainder.substring (parameter.length () + 1);
|
||||||
|
|
|
@ -22,7 +22,7 @@ class If extends Function
|
||||||
textFalse = Expression.getParameter (
|
textFalse = Expression.getParameter (
|
||||||
functionText.substring (conditionText.length () + textTrue.length () + 2));
|
functionText.substring (conditionText.length () + textTrue.length () + 2));
|
||||||
|
|
||||||
condition = new Condition (parent, cell, conditionText);
|
condition = new Condition (cell, conditionText);
|
||||||
values.add (condition);
|
values.add (condition);
|
||||||
|
|
||||||
expTrue = new Expression (cell, textTrue);
|
expTrue = new Expression (cell, textTrue);
|
||||||
|
|
|
@ -399,25 +399,25 @@ public class Sheet
|
||||||
while (counts.size () < 18)
|
while (counts.size () < 18)
|
||||||
counts.add ("");
|
counts.add ("");
|
||||||
|
|
||||||
text.append (String.format ("%-85.85s%n", underline));
|
text.append (String.format ("+%-83.83s+%n", underline));
|
||||||
text.append (String.format ("Global format : %-18s %-18s %-18s %s%n", globalFormat,
|
text.append (String.format ("| Global format : %-18s %-14s %-14s %-14s |%n",
|
||||||
counts.get (0), counts.get (6), counts.get (12)));
|
globalFormat, counts.get (0), counts.get (6), counts.get (12)));
|
||||||
text.append (String.format ("Column width : %-2d %-15s %-18s %-18s %s%n",
|
text.append (String.format ("| Column width : %-2d %-15s %-14s %-14s %-14s |%n",
|
||||||
columnWidth, "", counts.get (1), counts.get (7), counts.get (13)));
|
columnWidth, "", counts.get (1), counts.get (7), counts.get (13)));
|
||||||
text.append (String.format ("Recalc order : %-18s %-18s %-18s %s%n",
|
text.append (String.format ("| Recalc order : %-18s %-14s %-14s %-14s |%n",
|
||||||
recalculationOrder == 'R' ? "Row" : "Column", counts.get (2), counts.get (8),
|
recalculationOrder == 'R' ? "Row" : "Column", counts.get (2), counts.get (8),
|
||||||
counts.get (14)));
|
counts.get (14)));
|
||||||
text.append (String.format ("Recalculation : %-18s %-18s %-18s %s%n",
|
text.append (String.format ("| Recalculation : %-18s %-14s %-14s %-14s |%n",
|
||||||
recalculation == 'A' ? "Automatic" : "Manual", counts.get (3), counts.get (9),
|
recalculation == 'A' ? "Automatic" : "Manual", counts.get (3), counts.get (9),
|
||||||
counts.get (15)));
|
counts.get (15)));
|
||||||
text.append (String.format ("Cells : %-5d %-11s %-18s %-18s %s%n", size (),
|
text.append (String.format ("| Cells : %-5d %-11s %-14s %-14s %-14s |%n",
|
||||||
"", counts.get (4), counts.get (10), counts.get (16)));
|
size (), "", counts.get (4), counts.get (10), counts.get (16)));
|
||||||
|
|
||||||
String rangeText = size () > 0 ? Address.getCellName (minRow + 1, minColumn) + ":"
|
String rangeText = size () > 0 ? Address.getCellName (minRow + 1, minColumn) + ":"
|
||||||
+ Address.getCellName (maxRow + 1, maxColumn) : "";
|
+ Address.getCellName (maxRow + 1, maxColumn) : "";
|
||||||
text.append (String.format ("Range : %-18s %-18s %-18s %s%n", rangeText,
|
text.append (String.format ("| Range : %-18s %-14s %-14s %-14s |%n",
|
||||||
counts.get (5), counts.get (11), counts.get (17)));
|
rangeText, counts.get (5), counts.get (11), counts.get (17)));
|
||||||
text.append (String.format ("%-85.85s%n", underline));
|
text.append (String.format ("+%-83.83s+%n", underline));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,8 @@ import java.util.List;
|
||||||
|
|
||||||
public class ValueList implements Iterable<Value>
|
public class ValueList implements Iterable<Value>
|
||||||
{
|
{
|
||||||
protected List<Value> values = new ArrayList<Value> ();
|
private final List<Value> values = new ArrayList<Value> ();
|
||||||
|
private boolean rangeFound;
|
||||||
|
|
||||||
public ValueList (Cell cell, String text)
|
public ValueList (Cell cell, String text)
|
||||||
{
|
{
|
||||||
|
@ -18,8 +19,11 @@ public class ValueList implements Iterable<Value>
|
||||||
String parameter = Expression.getParameter (remainder);
|
String parameter = Expression.getParameter (remainder);
|
||||||
|
|
||||||
if (Range.isRange (parameter))
|
if (Range.isRange (parameter))
|
||||||
|
{
|
||||||
|
rangeFound = true;
|
||||||
for (Address address : new Range (parent, cell, parameter))
|
for (Address address : new Range (parent, cell, parameter))
|
||||||
values.add (parent.getCell (address));
|
values.add (parent.getCell (address));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
values.add (new Expression (cell, parameter).reduce ());
|
values.add (new Expression (cell, parameter).reduce ());
|
||||||
|
|
||||||
|
@ -30,6 +34,11 @@ public class ValueList implements Iterable<Value>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasRange ()
|
||||||
|
{
|
||||||
|
return rangeFound;
|
||||||
|
}
|
||||||
|
|
||||||
public Value get (int index)
|
public Value get (int index)
|
||||||
{
|
{
|
||||||
return values.get (index);
|
return values.get (index);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user