diff options
author | Sven Gothel <[email protected]> | 2014-03-01 16:47:30 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-03-01 16:47:30 +0100 |
commit | 183e1bc1868699b99eb9f9c8bf18d646d1120a48 (patch) | |
tree | e1ea001486615e7cc41e467a48f8fb3681444ac1 /src/jogl/classes/com/jogamp/graph/font | |
parent | 7a1dbd0d87a15f582f568a20adbbe42505bdca33 (diff) |
Bug 801: VBAA Render-Mode Based on SampleCount (not a user-based texWidth) ; Proper FontSize -> PixelSize
VBAA Render-Mode Based on SampleCount (not a user-based texWidth)
- All Region based APIs now use 'sampleCount' instead of 'texWidth'
- VBORegion2PES2 calculates perspective FBO width/height considering the sampleCount
Proper FontSize -> PixelSize
- Font: Add getPixelSize(fontSize, dpi)
- Text* Demos/Classes: Use proper fontSize -> PixelSize
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/font')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/font/Font.java | 42 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/font/FontFactory.java | 21 |
2 files changed, 57 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java index 9758e4d41..2f21fd214 100644 --- a/src/jogl/classes/com/jogamp/graph/font/Font.java +++ b/src/jogl/classes/com/jogamp/graph/font/Font.java @@ -32,14 +32,28 @@ import com.jogamp.opengl.math.geom.AABBox; /** * Interface wrapper for font implementation. - * + * <p> * TrueType Font Specification: - * http://developer.apple.com/fonts/ttrefman/rm06/Chap6.html - * http://www.microsoft.com/typography/SpecificationsOverview.mspx - * http://www.microsoft.com/typography/otspec/ - * + * <ul> + * <li>http://www.freetype.org/freetype2/documentation.html</li> + * <li>http://developer.apple.com/fonts/ttrefman/rm06/Chap6.html</li> + * <li>http://www.microsoft.com/typography/SpecificationsOverview.mspx</li> + * <li>http://www.microsoft.com/typography/otspec/</li> + * </ul> + * </p> + * <p> * TrueType Font Table Introduction: - * http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08 + * <ul> + * <li>http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08</li> + * </ul> + * </p> + * <p> + * Misc.: + * <ul> + * <li>Treatis on Font <code>Rasterization https://freddie.witherden.org/pages/font-rasterisation/</code></li> + * <li>Glyph Hell <code>http://walon.org/pub/ttf/ttf_glyphs.htm</code></li> + * </ul> + * </p> */ public interface Font { @@ -109,6 +123,22 @@ public interface Font { public StringBuilder getAllNames(StringBuilder string, String separator); + /** + * <pre> + Font Scale Formula: + inch: 25.4 mm + pointSize: [point] = [1/72 inch] + + [1] Scale := pointSize * resolution / ( 72 points per inch * units_per_em ) + [2] PixelSize := pointSize * resolution / ( 72 points per inch ) + [3] Scale := PixelSize / units_per_em + * </pre> + * @param fontSize in point-per-inch + * @param resolution display resolution in dots-per-inch + * @return pixel-per-inch, pixelSize scale factor for font operations. + */ + public float getPixelSize(float fontSize /* points per inch */, float resolution); + public float getAdvanceWidth(int glyphID, float pixelSize); public Metrics getMetrics(); public Glyph getGlyph(char symbol); diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java index d39bda004..948600a4a 100644 --- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java +++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java @@ -29,10 +29,13 @@ package com.jogamp.graph.font; import java.io.File; import java.io.IOException; +import java.net.URI; import java.net.URLConnection; +import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; +import com.jogamp.common.util.cache.TempJarCache; import jogamp.graph.font.FontConstructor; import jogamp.graph.font.JavaFontLoader; @@ -92,6 +95,24 @@ public class FontFactory { return fontConstr.create(conn); } + public static final Font get(final Class<?> context, final String fname, final boolean useTempJarCache) throws IOException { + URLConnection conn = null; + if( useTempJarCache ) { + try { + final URI uri = TempJarCache.getResource(fname); + conn = null != uri ? uri.toURL().openConnection() : null; + } catch (Exception e) { + throw new IOException(e); + } + } else { + conn = IOUtil.getResource(context, fname); + } + if(null != conn) { + return FontFactory.get ( conn ) ; + } + return null; + } + public static boolean isPrintableChar( char c ) { if( Character.isWhitespace(c) ) { return true; |