68 DisposerRecord getDisposer() { 69 if (disposer == null) { 70 // Caller will arrange for the disposer to be enqueued. 71 // Strikes are partialy managed by a GlyphCache such that when it 72 // wants to free space there it calls back to remove the 73 // strike from a font's map. 74 // So we could instead arrange for synchronously freeing the resources 75 // at that time, in which case a disposer reference queue isn't needed. 76 // But the disposer is more certain (safer). 77 disposer = createDisposer(desc); 78 } 79 return disposer; 80 } 81 82 protected abstract DisposerRecord createDisposer(FontStrikeDesc desc); 83 84 public synchronized void clearDesc() { 85 fontResource.getStrikeMap().remove(desc); 86 // Native resources are freed via a disposer once we are sure 87 // all references are cleared. It also ensures we don't leak. 88 // So this is approach is not used right now, in favour of a disposer. 89 //T2KFontFile.freePointer(pScalerContext); 90 //pScalerContext = 0L; 91 } 92 93 /** 94 * Returns the notional size of this strike with 95 * the graphics transform factored out. This is presently 96 * needed for the J2D pipeline but arguably the strike should 97 * not even need to keep this around except for needing to 98 * return metrics and outlines in user space. The consequence is 99 * we can't share a strike between 12 pt at scale of 2.0 and 24 pt 100 * at scale of 1.0 101 */ 102 public float getSize() { 103 return size; 104 } 105 106 public Metrics getMetrics() { 107 // I don't need native code to do this .. it can be done 108 // by just reading the hhea table once for the font. This should 109 // save a JNI call per strike. 110 // T2K uses the hhea table. Maybe we should use OS/2 metrics | 68 DisposerRecord getDisposer() { 69 if (disposer == null) { 70 // Caller will arrange for the disposer to be enqueued. 71 // Strikes are partialy managed by a GlyphCache such that when it 72 // wants to free space there it calls back to remove the 73 // strike from a font's map. 74 // So we could instead arrange for synchronously freeing the resources 75 // at that time, in which case a disposer reference queue isn't needed. 76 // But the disposer is more certain (safer). 77 disposer = createDisposer(desc); 78 } 79 return disposer; 80 } 81 82 protected abstract DisposerRecord createDisposer(FontStrikeDesc desc); 83 84 public synchronized void clearDesc() { 85 fontResource.getStrikeMap().remove(desc); 86 // Native resources are freed via a disposer once we are sure 87 // all references are cleared. It also ensures we don't leak. 88 } 89 90 /** 91 * Returns the notional size of this strike with 92 * the graphics transform factored out. This is presently 93 * needed for the J2D pipeline but arguably the strike should 94 * not even need to keep this around except for needing to 95 * return metrics and outlines in user space. The consequence is 96 * we can't share a strike between 12 pt at scale of 2.0 and 24 pt 97 * at scale of 1.0 98 */ 99 public float getSize() { 100 return size; 101 } 102 103 public Metrics getMetrics() { 104 // I don't need native code to do this .. it can be done 105 // by just reading the hhea table once for the font. This should 106 // save a JNI call per strike. 107 // T2K uses the hhea table. Maybe we should use OS/2 metrics |