Example #1
0
  // convert value in other unit to this unit
  public float toUnit(TeXParser parser, float value, TeXUnit otherUnit) throws TeXSyntaxException {
    if (equals(otherUnit)) {
      return value;
    }

    if (otherUnit.equals(FixedUnit.PT)) {
      return value / parser.getListener().emToPt(1f);
    }

    return otherUnit.toPt(parser, value) / parser.getListener().emToPt(1f);
  }
Example #2
0
  // convert value in this unit to other unit
  public float fromUnit(TeXParser parser, float value, TeXUnit otherUnit)
      throws TeXSyntaxException {
    if (equals(otherUnit)) {
      return value;
    }

    if (otherUnit.equals(FixedUnit.PT)) {
      return parser.getListener().emToPt(value);
    }

    return otherUnit.fromPt(parser, parser.getListener().emToPt(value));
  }
Example #3
0
 public void process(TeXParser parser) throws IOException {
   parser.getListener().getWriteable().write("em");
 }
Example #4
0
 public float fromPt(TeXParser parser, float value) throws TeXSyntaxException {
   return value / parser.getListener().emToPt(1f);
 }
Example #5
0
 public float toPt(TeXParser parser, float value) throws TeXSyntaxException {
   return parser.getListener().emToPt(value);
 }
Example #6
0
  public TeXObjectList string(TeXParser parser) throws IOException {
    TeXObjectList list = new TeXObjectList();
    list.add(parser.getListener().getOther((int) parser.getTabChar()));

    return list;
  }