CFFScaler.java
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.fontengine.font.cff;
import com.adobe.fontengine.font.BitmapConsumer;
import com.adobe.fontengine.font.InvalidFontException;
import com.adobe.fontengine.font.Matrix;
import com.adobe.fontengine.font.OutlineConsumer;
import com.adobe.fontengine.font.OutlineConsumer2;
import com.adobe.fontengine.font.OutlineConsumerAdapter;
import com.adobe.fontengine.font.Scaler;
import com.adobe.fontengine.font.ScalerDebugger;
import com.adobe.fontengine.font.ScanConverter;
import com.adobe.fontengine.font.UnsupportedFontException;
import com.adobe.fontengine.font.cff.CFFFont;
public class CFFScaler
implements Scaler {
protected final CFFFont font;
protected final ScanConverter scanConverter;
protected Matrix emToPixel;
protected ScalerDebugger debugger;
public CFFScaler(CFFFont font, ScanConverter scanConverter) {
this.font = font;
this.scanConverter = scanConverter;
}
public void setScale(double pointSize, double ppemX, double ppemY, double dX, double dY) throws InvalidFontException, UnsupportedFontException {
this.emToPixel = new Matrix(ppemX, 0.0, 0.0, ppemY, dX, dY);
}
public void getOutline(int gid, OutlineConsumer outlineConsumer) throws UnsupportedFontException, InvalidFontException {
this.font.getGlyphOutline(gid, outlineConsumer);
}
public void getBitmap(int gid, BitmapConsumer bitmapConsumer) throws UnsupportedFontException, InvalidFontException {
OutlineConsumer2 consumer = this.scanConverter.getOutlineConsumer2();
consumer.startOutline();
OutlineConsumerAdapter adapter = new OutlineConsumerAdapter(consumer);
adapter.setEmToPixelMatrix(this.emToPixel);
adapter.startOutline();
this.font.getGlyphOutline(gid, adapter);
adapter.endOutline();
this.scanConverter.getBitmap(bitmapConsumer);
}
public void setDebugger(ScalerDebugger debugger) {
this.debugger = debugger;
this.scanConverter.setDebugger(debugger);
}
}