mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-19 14:29:39 +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 ();
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
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
|
||||
|
||||
System.arraycopy (buffer, 4, exactBuffer, 0, exactBuffer.length);
|
||||
|
||||
if (name.endsWith (".FONT") || name.endsWith (" FONT") || name.endsWith (".SET")
|
||||
|| name.startsWith ("ASCII."))
|
||||
if ((name.endsWith (".FONT") || name.endsWith (" FONT")
|
||||
|| name.endsWith (".SET") || name.startsWith ("ASCII."))
|
||||
&& FontFile.isFont (exactBuffer))
|
||||
appleFile = new FontFile (name, exactBuffer);
|
||||
else if (ShapeTable.isShapeTable (exactBuffer))
|
||||
appleFile = new ShapeTable (name, exactBuffer);
|
||||
|
|
|
@ -7,8 +7,6 @@ class Condition extends AbstractValue implements Iterable<Value>
|
|||
{
|
||||
private static final String[] comparators = { "<>", "<=", ">=", "=", "<", ">" };
|
||||
|
||||
private final Sheet parent;
|
||||
|
||||
private String comparator;
|
||||
private String conditionText;
|
||||
private String valueText;
|
||||
|
@ -17,10 +15,9 @@ class Condition extends AbstractValue implements Iterable<Value>
|
|||
private Expression conditionExpression;
|
||||
private Expression valueExpression;
|
||||
|
||||
public Condition (Sheet parent, Cell cell, String text)
|
||||
public Condition (Cell cell, String text)
|
||||
{
|
||||
super ("Cond");
|
||||
this.parent = parent;
|
||||
fullText = text;
|
||||
|
||||
for (String comp : comparators)
|
||||
|
|
|
@ -6,17 +6,17 @@ import java.util.List;
|
|||
|
||||
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)
|
||||
{
|
||||
Sheet parent = cell.getParent ();
|
||||
// Sheet parent = cell.getParent ();
|
||||
String remainder = text;
|
||||
|
||||
while (true)
|
||||
{
|
||||
String parameter = Expression.getParameter (remainder);
|
||||
conditions.add (new Condition (parent, cell, parameter));
|
||||
conditions.add (new Condition (cell, parameter));
|
||||
if (remainder.length () == parameter.length ())
|
||||
break;
|
||||
remainder = remainder.substring (parameter.length () + 1);
|
||||
|
|
|
@ -22,7 +22,7 @@ class If extends Function
|
|||
textFalse = Expression.getParameter (
|
||||
functionText.substring (conditionText.length () + textTrue.length () + 2));
|
||||
|
||||
condition = new Condition (parent, cell, conditionText);
|
||||
condition = new Condition (cell, conditionText);
|
||||
values.add (condition);
|
||||
|
||||
expTrue = new Expression (cell, textTrue);
|
||||
|
|
|
@ -399,25 +399,25 @@ public class Sheet
|
|||
while (counts.size () < 18)
|
||||
counts.add ("");
|
||||
|
||||
text.append (String.format ("%-85.85s%n", underline));
|
||||
text.append (String.format ("Global format : %-18s %-18s %-18s %s%n", 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 ("+%-83.83s+%n", underline));
|
||||
text.append (String.format ("| Global format : %-18s %-14s %-14s %-14s |%n",
|
||||
globalFormat, counts.get (0), counts.get (6), counts.get (12)));
|
||||
text.append (String.format ("| Column width : %-2d %-15s %-14s %-14s %-14s |%n",
|
||||
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),
|
||||
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),
|
||||
counts.get (15)));
|
||||
text.append (String.format ("Cells : %-5d %-11s %-18s %-18s %s%n", size (),
|
||||
"", counts.get (4), counts.get (10), counts.get (16)));
|
||||
text.append (String.format ("| Cells : %-5d %-11s %-14s %-14s %-14s |%n",
|
||||
size (), "", counts.get (4), counts.get (10), counts.get (16)));
|
||||
|
||||
String rangeText = size () > 0 ? Address.getCellName (minRow + 1, minColumn) + ":"
|
||||
+ Address.getCellName (maxRow + 1, maxColumn) : "";
|
||||
text.append (String.format ("Range : %-18s %-18s %-18s %s%n", rangeText,
|
||||
counts.get (5), counts.get (11), counts.get (17)));
|
||||
text.append (String.format ("%-85.85s%n", underline));
|
||||
text.append (String.format ("| Range : %-18s %-14s %-14s %-14s |%n",
|
||||
rangeText, counts.get (5), counts.get (11), counts.get (17)));
|
||||
text.append (String.format ("+%-83.83s+%n", underline));
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
|
|
@ -6,7 +6,8 @@ import java.util.List;
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -18,8 +19,11 @@ public class ValueList implements Iterable<Value>
|
|||
String parameter = Expression.getParameter (remainder);
|
||||
|
||||
if (Range.isRange (parameter))
|
||||
{
|
||||
rangeFound = true;
|
||||
for (Address address : new Range (parent, cell, parameter))
|
||||
values.add (parent.getCell (address));
|
||||
}
|
||||
else
|
||||
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)
|
||||
{
|
||||
return values.get (index);
|
||||
|
|
Loading…
Reference in New Issue
Block a user