diff options
Diffstat (limited to 'src/jogl/classes/jogamp/graph')
115 files changed, 1027 insertions, 1027 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java index 1f59b5805..515583b14 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java @@ -30,20 +30,20 @@ package jogamp.graph.curve.opengl; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; -/** RegionFactory to create a Context specific Region implementation. - * +/** RegionFactory to create a Context specific Region implementation. + * * @see GLRegion */ public class RegionFactory { - + /** * Create a Region using the passed render mode - * + * * <p> In case {@link Region#VBAA_RENDERING_BIT} is being requested the default texture unit * {@link Region#TWO_PASS_DEFAULT_TEXTURE_UNIT} is being used.</p> - * + * * @param rs the RenderState to be used - * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} + * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} */ public static GLRegion create(int renderModes) { if( 0 != ( Region.VBAA_RENDERING_BIT & renderModes ) ){ @@ -53,18 +53,18 @@ public class RegionFactory { return new VBORegionSPES2(renderModes); } } - + /** Create a Single Pass Region using the passed render mode - * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, + * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, * {@link Region#VBAA_RENDERING_BIT} * @return */ public static GLRegion createSinglePass(int renderModes) { return new VBORegionSPES2(renderModes); } - + /** Create a Two Pass (VBAA) Region using the passed render mode - * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, + * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, * {@link Region#VBAA_RENDERING_BIT} * @return */ diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java index 7f5afcd02..22600cb89 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java @@ -43,12 +43,12 @@ import com.jogamp.opengl.util.glsl.ShaderState; public class RegionRendererImpl01 extends RegionRenderer { public RegionRendererImpl01(RenderState rs, int renderModes) { super(rs, renderModes); - + } - + protected boolean initShaderProgram(GL2ES2 gl) { final ShaderState st = rs.getShaderState(); - + final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RegionRendererImpl01.class, "shader", "shader/bin", getVertexShaderName(), true); final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RegionRendererImpl01.class, "shader", @@ -57,29 +57,29 @@ public class RegionRendererImpl01 extends RegionRenderer { // rsFp.defaultShaderCustomization(gl, true, true); int pos = rsFp.addGLSLVersion(gl); if( gl.isGLES2() ) { - pos = rsFp.insertShaderSource(0, pos, ShaderCode.extOESDerivativesEnable); + pos = rsFp.insertShaderSource(0, pos, ShaderCode.extOESDerivativesEnable); } final String rsFpDefPrecision = getFragmentShaderPrecision(gl); if( null != rsFpDefPrecision ) { rsFp.insertShaderSource(0, pos, rsFpDefPrecision); } - + final ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); sp.add(rsFp); - if( !sp.init(gl) ) { + if( !sp.init(gl) ) { throw new GLException("RegionRenderer: Couldn't init program: "+sp); } - st.attachShaderProgram(gl, sp, false); + st.attachShaderProgram(gl, sp, false); st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME); - st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME); - + st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME); + if(!sp.link(gl, System.err)) { throw new GLException("RegionRenderer: Couldn't link program: "+sp); - } + } st.useProgram(gl, true); - + if(DEBUG) { System.err.println("RegionRendererImpl01 initialized: " + Thread.currentThread()+" "+st); } @@ -94,5 +94,5 @@ public class RegionRendererImpl01 extends RegionRenderer { @Override protected void drawImpl(GL2ES2 gl, Region region, float[] position, int[] texSize) { ((GLRegion)region).draw(gl, rs, vp_width, vp_height, texSize); - } + } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java index 51356ca13..8ca29b9f0 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java @@ -38,9 +38,9 @@ import com.jogamp.graph.geom.Vertex; import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderState; -public class RenderStateImpl extends RenderState { +public class RenderStateImpl extends RenderState { /** - * weight is equivalent to the + * weight is equivalent to the * global off-curve vertex weight. * TODO: change to per vertex */ @@ -50,7 +50,7 @@ public class RenderStateImpl extends RenderState { public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory, PMVMatrix pmvMatrix) { super(st, pointFactory, pmvMatrix); - + gcu_Weight = new GLUniformData(UniformNames.gcu_Weight, 1.0f); st.ownUniform(gcu_PMVMatrix); gcu_Alpha = new GLUniformData(UniformNames.gcu_Alpha, 1.0f); @@ -60,15 +60,15 @@ public class RenderStateImpl extends RenderState { // gcu_Strength = new GLUniformData(UniformNames.gcu_Strength, 3.0f); // st.ownUniform(gcu_Strength); } - + public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory) { this(st, pointFactory, new PMVMatrix()); } - + public final GLUniformData getWeight() { return gcu_Weight; } public final GLUniformData getAlpha() { return gcu_Alpha; } public final GLUniformData getColorStatic() { return gcu_ColorStatic; } //public final GLUniformData getStrength() { return gcu_Strength; } - - + + } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java index 81c421371..60758b90b 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java @@ -40,11 +40,11 @@ import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.glsl.ShaderState; -public class TextRendererImpl01 extends TextRenderer { +public class TextRendererImpl01 extends TextRenderer { public TextRendererImpl01(RenderState rs, int type) { - super(rs, type); + super(rs, type); } - + @Override protected boolean initShaderProgram(GL2ES2 gl){ final ShaderState st = rs.getShaderState(); @@ -63,18 +63,18 @@ public class TextRendererImpl01 extends TextRenderer { if( null != rsFpDefPrecision ) { rsFp.insertShaderSource(0, pos, rsFpDefPrecision); } - + final ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); sp.add(rsFp); - - if( !sp.init(gl) ) { + + if( !sp.init(gl) ) { throw new GLException("RegionRenderer: Couldn't init program: "+sp); } - st.attachShaderProgram(gl, sp, false); + st.attachShaderProgram(gl, sp, false); st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME); - st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME); - + st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME); + if(!sp.link(gl, System.err)) { throw new GLException("TextRendererImpl01: Couldn't link program: "+sp); } @@ -82,15 +82,15 @@ public class TextRendererImpl01 extends TextRenderer { if(DEBUG) { System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st); - } + } return true; } - + @Override protected void destroyImpl(GL2ES2 gl) { super.destroyImpl(gl); } - + @Override public void drawString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int[/*1*/] texSize) { if(!isInitialized()){ @@ -101,7 +101,7 @@ public class TextRendererImpl01 extends TextRenderer { glyphString = createString(gl, font, fontSize, str); addCachedGlyphString(gl, font, str, fontSize, glyphString); } - + glyphString.renderString3D(gl, rs, vp_width, vp_height, texSize); } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java index 85d3ad5a7..86c0db8c6 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java @@ -30,7 +30,7 @@ package jogamp.graph.curve.opengl; import java.nio.FloatBuffer; import javax.media.opengl.GL2ES2; -// FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER ! +// FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER ! import javax.media.opengl.GL; import javax.media.opengl.GLUniformData; import javax.media.opengl.fixedfunc.GLMatrixFunc; @@ -58,90 +58,90 @@ public class VBORegion2PES2 extends GLRegion { private GLArrayDataServer verticeFboAttr; private GLArrayDataServer texCoordFboAttr; private GLArrayDataServer indicesFbo; - - + + private FBObject fbo; private TextureAttachment texA; private PMVMatrix fboPMVMatrix; GLUniformData mgl_fboPMVMatrix; - + private int tex_width_c = 0; private int tex_height_c = 0; - GLUniformData mgl_ActiveTexture; + GLUniformData mgl_ActiveTexture; GLUniformData mgl_TextureSize; // if GLSL < 1.30 - + public VBORegion2PES2(int renderModes, int textureEngine) { super(renderModes); fboPMVMatrix = new PMVMatrix(); - mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf()); - mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureEngine); + mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf()); + mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureEngine); } - + public void update(GL2ES2 gl, RenderState rs) { if(!isDirty()) { - return; + return; } if(null == indicesFbo) { final int initialElementCount = 256; final ShaderState st = rs.getShaderState(); - - indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + + indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3); indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3); indicesFbo.seal(true); - - texCoordFboAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, + + texCoordFboAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(texCoordFboAttr, true); - texCoordFboAttr.putf(5); texCoordFboAttr.putf(5); - texCoordFboAttr.putf(5); texCoordFboAttr.putf(6); - texCoordFboAttr.putf(6); texCoordFboAttr.putf(6); - texCoordFboAttr.putf(6); texCoordFboAttr.putf(5); + texCoordFboAttr.putf(5); texCoordFboAttr.putf(5); + texCoordFboAttr.putf(5); texCoordFboAttr.putf(6); + texCoordFboAttr.putf(6); texCoordFboAttr.putf(6); + texCoordFboAttr.putf(6); texCoordFboAttr.putf(5); texCoordFboAttr.seal(true); - - verticeFboAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, - false, initialElementCount, GL.GL_STATIC_DRAW); + + verticeFboAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(verticeFboAttr, true); - - - indicesTxt = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - - verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + + + indicesTxt = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + + verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(verticeTxtAttr, true); - - texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, + + texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(texCoordTxtAttr, true); - + if(DEBUG_INSTANCE) { System.err.println("VBORegion2PES2 Create: " + this); - } + } } // process triangles indicesTxt.seal(gl, false); - indicesTxt.rewind(); + indicesTxt.rewind(); for(int i=0; i<triangles.size(); i++) { final Triangle t = triangles.get(i); final Vertex[] t_vertices = t.getVertices(); - + if(t_vertices[0].getId() == Integer.MAX_VALUE){ t_vertices[0].setId(numVertices++); t_vertices[1].setId(numVertices++); t_vertices[2].setId(numVertices++); - + vertices.add(t_vertices[0]); vertices.add(t_vertices[1]); vertices.add(t_vertices[2]); - + indicesTxt.puts((short) t_vertices[0].getId()); indicesTxt.puts((short) t_vertices[1].getId()); indicesTxt.puts((short) t_vertices[2].getId()); } else { indicesTxt.puts((short) t_vertices[0].getId()); indicesTxt.puts((short) t_vertices[1].getId()); - indicesTxt.puts((short) t_vertices[2].getId()); + indicesTxt.puts((short) t_vertices[2].getId()); } } indicesTxt.seal(gl, true); @@ -157,43 +157,43 @@ public class VBORegion2PES2 extends GLRegion { final Vertex v = vertices.get(i); verticeTxtAttr.putf(v.getX()); verticeTxtAttr.putf(v.getY()); - verticeTxtAttr.putf(v.getZ()); - box.resize(v.getX(), v.getY(), v.getZ()); - + verticeTxtAttr.putf(v.getZ()); + box.resize(v.getX(), v.getY(), v.getZ()); + final float[] tex = v.getTexCoord(); texCoordTxtAttr.putf(tex[0]); - texCoordTxtAttr.putf(tex[1]); + texCoordTxtAttr.putf(tex[1]); } texCoordTxtAttr.seal(gl, true); texCoordTxtAttr.enableBuffer(gl, false); - verticeTxtAttr.seal(gl, true); + verticeTxtAttr.seal(gl, true); verticeTxtAttr.enableBuffer(gl, false); - + // update all bbox related data verticeFboAttr.seal(gl, false); - verticeFboAttr.rewind(); - verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.seal(gl, true); + verticeFboAttr.rewind(); + verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.seal(gl, true); verticeFboAttr.enableBuffer(gl, false); - + fboPMVMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); fboPMVMatrix.glLoadIdentity(); fboPMVMatrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1); - + // push data 2 GPU .. indicesFbo.seal(gl, true); indicesFbo.enableBuffer(gl, false); - + setDirty(false); - + // the buffers were disabled, since due to real/fbo switching and other vbo usage } - + int[] maxTexSize = new int[] { -1 } ; - + protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) { if(vp_width <=0 || vp_height <= 0 || null==texWidth || texWidth[0] <= 0){ renderRegion(gl); @@ -205,54 +205,54 @@ public class VBORegion2PES2 extends GLRegion { if(texWidth[0] > maxTexSize[0]) { texWidth[0] = maxTexSize[0]; // clip to max - write-back user value! } - renderRegion2FBO(gl, rs, texWidth); + renderRegion2FBO(gl, rs, texWidth); } // System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3)); renderFBO(gl, rs, vp_width, vp_height); } } - + private void renderFBO(GL2ES2 gl, RenderState rs, int width, int hight) { final ShaderState st = rs.getShaderState(); - - gl.glViewport(0, 0, width, hight); - st.uniform(gl, mgl_ActiveTexture); + + gl.glViewport(0, 0, width, hight); + st.uniform(gl, mgl_ActiveTexture); gl.glActiveTexture(GL.GL_TEXTURE0 + mgl_ActiveTexture.intValue()); - fbo.use(gl, texA); - verticeFboAttr.enableBuffer(gl, true); - texCoordFboAttr.enableBuffer(gl, true); + fbo.use(gl, texA); + verticeFboAttr.enableBuffer(gl, true); + texCoordFboAttr.enableBuffer(gl, true); indicesFbo.bindBuffer(gl, true); // keeps VBO binding - + gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); - - indicesFbo.bindBuffer(gl, false); + + indicesFbo.bindBuffer(gl, false); texCoordFboAttr.enableBuffer(gl, false); - verticeFboAttr.enableBuffer(gl, false); + verticeFboAttr.enableBuffer(gl, false); fbo.unuse(gl); - + // setback: gl.glActiveTexture(currentActiveTextureEngine[0]); } - + private void renderRegion2FBO(GL2ES2 gl, RenderState rs, int[/*1*/] texWidth) { final ShaderState st = rs.getShaderState(); - + if(0>=texWidth[0]) { throw new IllegalArgumentException("texWidth must be greater than 0: "+texWidth[0]); } - + tex_width_c = texWidth[0]; tex_height_c = (int) ( ( ( tex_width_c * box.getHeight() ) / box.getWidth() ) + 0.5f ); - + // System.out.println("FBO Size: "+texWidth[0]+" -> "+tex_width_c+"x"+tex_height_c); // System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5)); - + if(null != fbo && fbo.getWidth() != tex_width_c && fbo.getHeight() != tex_height_c ) { fbo.reset(gl, tex_width_c, tex_height_c); } - - if(null == fbo) { + + if(null == fbo) { fbo = new FBObject(); - fbo.reset(gl, tex_width_c, tex_height_c); + fbo.reset(gl, tex_width_c, tex_height_c); // FIXME: shall not use bilinear, due to own AA ? However, w/o bilinear result is not smooth texA = fbo.attachTexture2D(gl, 0, true, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); // texA = fbo.attachTexture2D(gl, 0, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); @@ -260,18 +260,18 @@ public class VBORegion2PES2 extends GLRegion { } else { fbo.bind(gl); } - + //render texture gl.glViewport(0, 0, tex_width_c, tex_height_c); st.uniform(gl, mgl_fboPMVMatrix); // use orthogonal matrix - + gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT); renderRegion(gl); fbo.unbind(gl); - + st.uniform(gl, rs.getPMVMatrix()); // switch back to real PMV matrix - + // if( !gl.isGL3() ) { // GLSL < 1.30 if(null == mgl_TextureSize) { @@ -281,21 +281,21 @@ public class VBORegion2PES2 extends GLRegion { texSize.put(0, (float)fbo.getWidth()); texSize.put(1, (float)fbo.getHeight()); st.uniform(gl, mgl_TextureSize); - //} + //} } - + private void renderRegion(GL2ES2 gl) { - verticeTxtAttr.enableBuffer(gl, true); + verticeTxtAttr.enableBuffer(gl, true); texCoordTxtAttr.enableBuffer(gl, true); indicesTxt.bindBuffer(gl, true); // keeps VBO binding - + gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementCount() * indicesTxt.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); - - indicesTxt.bindBuffer(gl, false); + + indicesTxt.bindBuffer(gl, false); texCoordTxtAttr.enableBuffer(gl, false); - verticeTxtAttr.enableBuffer(gl, false); + verticeTxtAttr.enableBuffer(gl, false); } - + public void destroy(GL2ES2 gl, RenderState rs) { if(DEBUG_INSTANCE) { System.err.println("VBORegion2PES2 Destroy: " + this); @@ -305,7 +305,7 @@ public class VBORegion2PES2 extends GLRegion { fbo.destroy(gl); fbo = null; texA = null; - } + } if(null != verticeTxtAttr) { st.ownAttribute(verticeTxtAttr, false); verticeTxtAttr.destroy(gl); @@ -335,6 +335,6 @@ public class VBORegion2PES2 extends GLRegion { indicesFbo = null; } triangles.clear(); - vertices.clear(); - } + vertices.clear(); + } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 0cba444ad..0a867b45c 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -44,13 +44,13 @@ public class VBORegionSPES2 extends GLRegion { private GLArrayDataServer texCoordAttr = null; private GLArrayDataServer indices = null; - protected VBORegionSPES2(int renderModes) { + protected VBORegionSPES2(int renderModes) { super(renderModes); } protected void update(GL2ES2 gl, RenderState rs) { if(!isDirty()) { - return; + return; } if(null == indices) { @@ -59,11 +59,11 @@ public class VBORegionSPES2 extends GLRegion { indices = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - verticeAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, - false, initialElementCount, GL.GL_STATIC_DRAW); + verticeAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(verticeAttr, true); - texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, + texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(texCoordAttr, true); @@ -74,7 +74,7 @@ public class VBORegionSPES2 extends GLRegion { // process triangles indices.seal(gl, false); - indices.rewind(); + indices.rewind(); for(int i=0; i<triangles.size(); i++) { final Triangle t = triangles.get(i); final Vertex[] t_vertices = t.getVertices(); @@ -102,7 +102,7 @@ public class VBORegionSPES2 extends GLRegion { // process vertices and update bbox box.reset(); - verticeAttr.seal(gl, false); + verticeAttr.seal(gl, false); verticeAttr.rewind(); texCoordAttr.seal(gl, false); texCoordAttr.rewind(); @@ -110,14 +110,14 @@ public class VBORegionSPES2 extends GLRegion { final Vertex v = vertices.get(i); verticeAttr.putf(v.getX()); verticeAttr.putf(v.getY()); - verticeAttr.putf(v.getZ()); + verticeAttr.putf(v.getZ()); box.resize(v.getX(), v.getY(), v.getZ()); final float[] tex = v.getTexCoord(); texCoordAttr.putf(tex[0]); texCoordAttr.putf(tex[1]); } - verticeAttr.seal(gl, true); + verticeAttr.seal(gl, true); verticeAttr.enableBuffer(gl, false); texCoordAttr.seal(gl, true); texCoordAttr.enableBuffer(gl, false); @@ -126,21 +126,21 @@ public class VBORegionSPES2 extends GLRegion { } protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) { - verticeAttr.enableBuffer(gl, true); - texCoordAttr.enableBuffer(gl, true); + verticeAttr.enableBuffer(gl, true); + texCoordAttr.enableBuffer(gl, true); indices.bindBuffer(gl, true); // keeps VBO binding - + gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementCount() * indices.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); - + indices.bindBuffer(gl, false); texCoordAttr.enableBuffer(gl, false); - verticeAttr.enableBuffer(gl, false); - } + verticeAttr.enableBuffer(gl, false); + } public final void destroy(GL2ES2 gl, RenderState rs) { if(DEBUG_INSTANCE) { System.err.println("VBORegionSPES2 Destroy: " + this); - } + } final ShaderState st = rs.getShaderState(); if(null != verticeAttr) { st.ownAttribute(verticeAttr, false); @@ -156,5 +156,5 @@ public class VBORegionSPES2 extends GLRegion { indices.destroy(gl); indices = null; } - } + } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java index 8a109c34a..b46661778 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -37,9 +37,9 @@ public class AttributeNames { */ public static final int TEXCOORD_ATTR_IDX = 1; public static final String TEXCOORD_ATTR_NAME = "gca_TexCoords"; - + /** The color index in an OGL object */ public static final int COLOR_ATTR_IDX = 2; - public static final String COLOR_ATTR_NAME = "gca_Colors"; + public static final String COLOR_ATTR_NAME = "gca_Colors"; } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java index ab6e0dc6e..ce23aadac 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java @@ -3,7 +3,7 @@ package jogamp.graph.curve.opengl.shader; public class UniformNames { public static final String gcu_PMVMatrix = "gcu_PMVMatrix"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi public static final String gcu_ColorStatic = "gcu_ColorStatic"; - public static final String gcu_Alpha = "gcu_Alpha"; + public static final String gcu_Alpha = "gcu_Alpha"; public static final String gcu_Weight = "gcu_Weight"; public static final String gcu_TextureUnit = "gcu_TextureUnit"; public static final String gcu_TextureSize = "gcu_TextureSize"; diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java index e96c559a2..4f48b2d20 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -39,29 +39,29 @@ import com.jogamp.opengl.math.VectorUtil; import jogamp.opengl.Debug; -/** Constrained Delaunay Triangulation +/** Constrained Delaunay Triangulation * implementation of a list of Outlines that define a set of * Closed Regions with optional n holes. - * + * */ public class CDTriangulator2D implements Triangulator{ protected static final boolean DEBUG = Debug.debug("Triangulation"); - + private float sharpness = 0.5f; private ArrayList<Loop> loops; private ArrayList<Vertex> vertices; - + private ArrayList<Triangle> triangles; private int maxTriID = 0; - + /** Constructor for a new Delaunay triangulator */ public CDTriangulator2D() { reset(); } - + /** Reset the triangulation to initial state * Clearing cached data */ @@ -71,14 +71,14 @@ public class CDTriangulator2D implements Triangulator{ triangles = new ArrayList<Triangle>(3); loops = new ArrayList<Loop>(); } - + public void addCurve(Outline polyline) { Loop loop = null; - + if(!loops.isEmpty()) { loop = getContainerLoop(polyline); } - + if(loop == null) { GraphOutline outline = new GraphOutline(polyline); GraphOutline innerPoly = extractBoundaryTriangles(outline, false); @@ -92,8 +92,8 @@ public class CDTriangulator2D implements Triangulator{ loop.addConstraintCurve(innerPoly); } } - - public ArrayList<Triangle> generate() { + + public ArrayList<Triangle> generate() { for(int i=0;i<loops.size();i++) { Loop loop = loops.get(i); int numTries = 0; @@ -140,16 +140,16 @@ public class CDTriangulator2D implements Triangulator{ GraphVertex gv0 = outVertices.get((i+size-1)%size); GraphVertex gv2 = outVertices.get((i+1)%size); GraphVertex gv1 = currentVertex; - + if(!currentVertex.getPoint().isOnCurve()) { Vertex v0 = gv0.getPoint().clone(); Vertex v2 = gv2.getPoint().clone(); Vertex v1 = gv1.getPoint().clone(); - + gv0.setBoundaryContained(true); gv1.setBoundaryContained(true); gv2.setBoundaryContained(true); - + final Triangle t; final boolean holeLike; if(VectorUtil.ccw(v0,v1,v2)) { @@ -184,7 +184,7 @@ public class CDTriangulator2D implements Triangulator{ } return innerOutline; } - + private Loop getContainerLoop(Outline polyline) { ArrayList<Vertex> vertices = polyline.getVertices(); for(int i=0; i < loops.size(); i++) { diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java index c8251af15..2e8d4f58f 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java @@ -35,13 +35,13 @@ import com.jogamp.graph.geom.Vertex; public class GraphOutline { final private Outline outline; final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3); - + public GraphOutline(){ this.outline = new Outline(); } - + /**Create a control polyline of control vertices - * the curve pieces can be identified by onCurve flag + * the curve pieces can be identified by onCurve flag * of each cp the control polyline is open by default */ public GraphOutline(Outline ol){ @@ -59,7 +59,7 @@ public class GraphOutline { public ArrayList<GraphVertex> getGraphPoint() { return controlpoints; } - + public ArrayList<Vertex> getVertices() { return outline.getVertices(); } @@ -68,5 +68,5 @@ public class GraphOutline { controlpoints.add(v); outline.addVertex(v.getPoint()); } - + } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java index 52d02baa5..1ef1d8c7f 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java @@ -35,7 +35,7 @@ public class GraphVertex { private Vertex point; private ArrayList<HEdge> edges = null; private boolean boundaryContained = false; - + public GraphVertex(Vertex point) { this.point = point; } @@ -43,15 +43,15 @@ public class GraphVertex { public Vertex getPoint() { return point; } - + public float getX(){ return point.getX(); } - + public float getY(){ return point.getY(); } - + public float getZ(){ return point.getZ(); } @@ -70,7 +70,7 @@ public class GraphVertex { public void setEdges(ArrayList<HEdge> edges) { this.edges = edges; } - + public void addEdge(HEdge edge){ if(edges == null){ edges = new ArrayList<HEdge>(); @@ -112,7 +112,7 @@ public class GraphVertex { } return null; } - + public boolean isBoundaryContained() { return boundaryContained; } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java index 4d29a81f3..acaa3d708 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java @@ -35,14 +35,14 @@ public class HEdge { public static int BOUNDARY = 3; public static int INNER = 1; public static int HOLE = 2; - + private GraphVertex vert; private HEdge prev = null; private HEdge next = null; private HEdge sibling = null; private int type = BOUNDARY; private Triangle triangle = null; - + public HEdge(GraphVertex vert, int type) { this.vert = vert; this.type = type; @@ -112,19 +112,19 @@ public class HEdge { public void setTriangle(Triangle triangle) { this.triangle = triangle; } - + public static <T extends Vertex> void connect(HEdge first, HEdge next){ first.setNext(next); next.setPrev(first); } - + public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){ first.setSibling(second); second.setSibling(first); } - + public boolean vertexOnCurveVertex(){ return vert.getPoint().isOnCurve(); } - + } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java index 651179062..c1dafc0d1 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java @@ -51,7 +51,7 @@ public class Loop { public Triangle cut(boolean delaunay){ if(isSimplex()){ - Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(), + Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(), root.getNext().getNext().getGraphPoint().getPoint()); t.setVerticesBoundary(checkVerticesBoundary(root)); return t; @@ -103,20 +103,20 @@ public class Loop { throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size()); } final VectorUtil.Winding hasWinding = VectorUtil.getWinding( - vertices.get(0).getPoint(), + vertices.get(0).getPoint(), vertices.get(1).getPoint(), vertices.get(2).getPoint()); //FIXME: handle case when vertices come inverted - Rami // skips inversion CW -> CCW final boolean invert = hasWinding != reqWinding && reqWinding == VectorUtil.Winding.CW; - + final int max; final int edgeType = reqWinding == VectorUtil.Winding.CCW ? HEdge.BOUNDARY : HEdge.HOLE ; int index; HEdge firstEdge = null; HEdge lastEdge = null; - + if(!invert) { max = vertices.size(); index = 0; @@ -160,7 +160,7 @@ public class Loop { public void addConstraintCurve(GraphOutline polyline) { // GraphOutline outline = new GraphOutline(polyline); /**needed to generate vertex references.*/ - initFromPolyline(polyline, VectorUtil.Winding.CW); + initFromPolyline(polyline, VectorUtil.Winding.CW); GraphVertex v3 = locateClosestVertex(polyline); HEdge v3Edge = v3.findBoundEdge(); @@ -180,9 +180,9 @@ public class Loop { HEdge.connect(crossEdgeSib, root); } - /** Locates the vertex and update the loops root - * to have (root + vertex) as closest pair - * @param polyline the control polyline + /** Locates the vertex and update the loops root + * to have (root + vertex) as closest pair + * @param polyline the control polyline * to search for closestvertices * @return the vertex that is closest to the newly set root Hedge. */ @@ -205,7 +205,7 @@ public class Loop { for (GraphVertex vert:vertices){ if(vert == v || vert == nextV || vert == cand) continue; - inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(), + inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(), cand.getPoint(), vert.getPoint()); if(inValid){ break; @@ -243,8 +243,8 @@ public class Loop { Vertex cand = candEdge.getGraphPoint().getPoint(); HEdge e = candEdge.getNext(); while (e != candEdge){ - if(e.getGraphPoint() == root.getGraphPoint() - || e.getGraphPoint() == next.getGraphPoint() + if(e.getGraphPoint() == root.getGraphPoint() + || e.getGraphPoint() == next.getGraphPoint() || e.getGraphPoint().getPoint() == cand){ e = e.getNext(); continue; @@ -311,15 +311,15 @@ public class Loop { (v.getX() < (v2.getX() - v1.getX()) * (v.getY() - v1.getY()) / (v2.getY() - v1.getY()) + v1.getX()) ){ inside = !inside; } - + current = next; next = current.getNext(); - + } while(current != root); - + return inside; } - + public int computeLoopSize(){ int size = 0; HEdge e = root; diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java index 751a7e7ac..ff46c3338 100644 --- a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java +++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java @@ -37,17 +37,17 @@ import com.jogamp.graph.curve.OutlineShape; import com.jogamp.opengl.math.Quaternion; public class GlyphShape { - + private Quaternion quat= null; private OutlineShape shape = null; - + /** Create a new Glyph shape * based on Parametric curve control polyline */ public GlyphShape(Vertex.Factory<? extends Vertex> factory){ shape = new OutlineShape(factory); } - + /** Create a new GlyphShape from a {@link OutlineShape} * @param factory vertex impl factory {@link Factory} * @param shape {@link OutlineShape} representation of the Glyph @@ -57,24 +57,24 @@ public class GlyphShape { this.shape = shape; this.shape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS); } - + public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); } - + public OutlineShape getShape() { return shape; } - + public int getNumVertices() { return shape.getVertices().size(); } - + /** Get the rotational Quaternion attached to this Shape * @return the Quaternion Object */ public Quaternion getQuat() { return quat; } - + /** Set the Quaternion that shall defien the rotation * of this shape. * @param quat @@ -82,7 +82,7 @@ public class GlyphShape { public void setQuat(Quaternion quat) { this.quat = quat; } - + /** Triangluate the glyph shape * @return ArrayList of triangles which define this shape */ @@ -95,5 +95,5 @@ public class GlyphShape { */ public ArrayList<Vertex> getVertices(){ return shape.getVertices(); - } + } } diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java index cc850b823..2284ab669 100644 --- a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java +++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java @@ -52,51 +52,51 @@ public class GlyphString { * <p>The actual font size shall be accomplished by the GL PMV matrix.</p> */ public static final int STATIC_FONT_SIZE = 10; - + private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>(); private CharSequence str; private String fontname; private GLRegion region; - + private SVertex origin = new SVertex(); /** * <p>Uses {@link #STATIC_FONT_SIZE}.</p> * <p>No caching is performed.</p> - * + * * @param shape is not null, add all {@link GlyphShape}'s {@link Outline} to this instance. * @param vertexFactory vertex impl factory {@link Factory} - * @param font the target {@link Font} + * @param font the target {@link Font} * @param str string text * @return the created {@link GlyphString} instance */ public static GlyphString createString(OutlineShape shape, Factory<? extends Vertex> vertexFactory, Font font, String str) { - return createString(shape, vertexFactory, font, STATIC_FONT_SIZE, str); + return createString(shape, vertexFactory, font, STATIC_FONT_SIZE, str); } - + /** * <p>No caching is performed.</p> - * + * * @param shape is not null, add all {@link GlyphShape}'s {@link Outline} to this instance. * @param vertexFactory vertex impl factory {@link Factory} - * @param font the target {@link Font} + * @param font the target {@link Font} * @param fontSize font size * @param str string text * @return the created {@link GlyphString} instance */ public static GlyphString createString(OutlineShape shape, Factory<? extends Vertex> vertexFactory, Font font, int fontSize, String str) { ArrayList<OutlineShape> shapes = ((FontInt)font).getOutlineShapes(str, fontSize, vertexFactory); - + GlyphString glyphString = new GlyphString(font.getName(Font.NAME_UNIQUNAME), str); glyphString.createfromOutlineShapes(vertexFactory, shapes); if(null != shape) { for(int i=0; i<glyphString.glyphs.size(); i++) { shape.addOutlineShape(glyphString.glyphs.get(i).getShape()); - } + } } return glyphString; } - + /** Create a new GlyphString object * @param fontname the name of the font that this String is * associated with @@ -106,18 +106,18 @@ public class GlyphString { this.fontname = fontname; this.str = str; } - + public void addGlyphShape(GlyphShape glyph){ glyphs.add(glyph); } - + public CharSequence getString(){ return str; } - /**Creates the Curve based Glyphs from a list of {@link OutlineShape} + /**Creates the Curve based Glyphs from a list of {@link OutlineShape} * @param vertexFactory vertex impl factory {@link Factory} - * @param shapes list of {@link OutlineShape} + * @param shapes list of {@link OutlineShape} */ public void createfromOutlineShapes(Factory<? extends Vertex> vertexFactory, ArrayList<OutlineShape> shapes) { final int numGlyps = shapes.size(); @@ -126,31 +126,31 @@ public class GlyphString { continue; } GlyphShape glyphShape = new GlyphShape(vertexFactory, shapes.get(index)); - + if(glyphShape.getNumVertices() < 3) { continue; - } + } addGlyphShape(glyphShape); } } - - + + /** Generate a OGL Region to represent this Object. * @param gl the current gl object * @param rs the current attached RenderState - * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} + * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} */ public GLRegion createRegion(GL2ES2 gl, int renderModes){ region = RegionFactory.create(renderModes); // region.setFlipped(true); - + int numVertices = region.getNumVertices(); - + for(int i=0; i< glyphs.size(); i++) { final GlyphShape glyph = glyphs.get(i); ArrayList<Triangle> gtris = glyph.triangulate(); region.addTriangles(gtris); - + final ArrayList<Vertex> gVertices = glyph.getVertices(); for(int j=0; j<gVertices.size(); j++) { final Vertex gVert = gVertices.get(j); @@ -160,8 +160,8 @@ public class GlyphString { } return region; } - - /** Generate a Hashcode for this object + + /** Generate a Hashcode for this object * @return a string defining the hashcode */ public String getTextHashCode(){ @@ -180,15 +180,15 @@ public class GlyphString { * @param rs the RenderState to be used * @param vp_width current screen width * @param vp_height current screen height - * @param texWidth desired texture width for multipass-rendering. + * @param texWidth desired texture width for multipass-rendering. * The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched. */ public void renderString3D(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) { region.draw(gl, rs, vp_width, vp_height, texWidth); } - + /** Get the Origin of this GlyphString - * @return + * @return */ public Vertex getOrigin() { return origin; @@ -206,7 +206,7 @@ public class GlyphString { } glyphs.clear(); } - + public AABBox getBounds(){ return region.getBounds(); } diff --git a/src/jogl/classes/jogamp/graph/font/FontInt.java b/src/jogl/classes/jogamp/graph/font/FontInt.java index 20e1ec028..4366724ad 100644 --- a/src/jogl/classes/jogamp/graph/font/FontInt.java +++ b/src/jogl/classes/jogamp/graph/font/FontInt.java @@ -40,7 +40,7 @@ public interface FontInt extends Font { public interface GlyphInt extends Font.Glyph { public Path2D getPath(); // unscaled path - public Path2D getPath(float pixelSize); + public Path2D getPath(float pixelSize); } public ArrayList<OutlineShape> getOutlineShapes(CharSequence string, float pixelSize, Factory<? extends Vertex> vertexFactory); diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java index 3736c5f13..5978e937d 100644 --- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java @@ -40,16 +40,16 @@ import com.jogamp.graph.font.FontSet; import com.jogamp.graph.font.FontFactory; public class JavaFontLoader implements FontSet { - - // FIXME: Add cache size to limit memory usage + + // FIXME: Add cache size to limit memory usage private static final IntObjectHashMap fontMap = new IntObjectHashMap(); - + private static final FontSet fontLoader = new JavaFontLoader(); public static FontSet get() { return fontLoader; } - + final static String availableFontFileNames[] = { /* 00 */ "LucidaBrightRegular.ttf", @@ -61,9 +61,9 @@ public class JavaFontLoader implements FontSet { /* 06 */ "LucidaTypewriterRegular.ttf", /* 07 */ "LucidaTypewriterBold.ttf", }; - + final String javaFontPath; - + private JavaFontLoader() { final String javaHome = AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { @@ -80,11 +80,11 @@ public class JavaFontLoader implements FontSet { static boolean is(int bits, int bit) { return 0 != ( bits & bit ) ; } - + public Font getDefault() throws IOException { - return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular + return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular } - + public Font get(int family, int style) throws IOException { Font font = (Font)fontMap.get( ( family << 8 ) | style ); if (font != null) { @@ -92,8 +92,8 @@ public class JavaFontLoader implements FontSet { } // 1st process Sans Serif (2 fonts) - if( is(style, STYLE_SERIF) ) { - if( is(style, STYLE_BOLD) ) { + if( is(style, STYLE_SERIF) ) { + if( is(style, STYLE_BOLD) ) { font = abspath(availableFontFileNames[5], family, style); } else { font = abspath(availableFontFileNames[4], family, style); @@ -103,53 +103,53 @@ public class JavaFontLoader implements FontSet { } return font; } - + // Serif Fonts .. switch (family) { case FAMILY_LIGHT: case FAMILY_MEDIUM: case FAMILY_CONDENSED: case FAMILY_REGULAR: - if( is(style, STYLE_BOLD) ) { - if( is(style, STYLE_ITALIC) ) { + if( is(style, STYLE_BOLD) ) { + if( is(style, STYLE_ITALIC) ) { font = abspath(availableFontFileNames[3], family, style); } else { font = abspath(availableFontFileNames[2], family, style); } - } else if( is(style, STYLE_ITALIC) ) { + } else if( is(style, STYLE_ITALIC) ) { font = abspath(availableFontFileNames[1], family, style); } else { font = abspath(availableFontFileNames[0], family, style); } break; - + case FAMILY_MONOSPACED: - if( is(style, STYLE_BOLD) ) { + if( is(style, STYLE_BOLD) ) { font = abspath(availableFontFileNames[7], family, style); } else { font = abspath(availableFontFileNames[6], family, style); } - break; + break; } return font; } - + Font abspath(String fname, int family, int style) throws IOException { if(null == javaFontPath) { throw new GLException("java font path undefined"); } final String err = "Problem loading font "+fname+", file "+javaFontPath+fname ; - + try { final Font f = FontFactory.get( new File(javaFontPath+fname) ); if(null != f) { fontMap.put( ( family << 8 ) | style, f ); return f; } - throw new IOException (err); + throw new IOException (err); } catch (IOException ioe) { - throw new IOException(err, ioe); + throw new IOException(err, ioe); } - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java index c4c580290..254583739 100644 --- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java @@ -39,23 +39,23 @@ import com.jogamp.graph.font.FontFactory; import java.net.URLConnection; public class UbuntuFontLoader implements FontSet { - - // FIXME: Add cache size to limit memory usage + + // FIXME: Add cache size to limit memory usage private static final IntObjectHashMap fontMap = new IntObjectHashMap(); - - private static final String relPath = "fonts/ubuntu/" ; - + + private static final String relPath = "fonts/ubuntu/" ; + private static final FontSet fontLoader = new UbuntuFontLoader(); public static final FontSet get() { return fontLoader; } - + final static String availableFontFileNames[] = { /* 00 */ "Ubuntu-R.ttf", // regular /* 01 */ "Ubuntu-RI.ttf", // regular italic - /* 02 */ "Ubuntu-B.ttf", // bold + /* 02 */ "Ubuntu-B.ttf", // bold /* 03 */ "Ubuntu-BI.ttf", // bold italic /* 04 */ "Ubuntu-L.ttf", // light /* 05 */ "Ubuntu-LI.ttf", // light italic @@ -63,18 +63,18 @@ public class UbuntuFontLoader implements FontSet { /* 07 */ "Ubuntu-MI.ttf", // medium italic }; - + private UbuntuFontLoader() { } static boolean is(int bits, int bit) { return 0 != ( bits & bit ) ; } - + public Font getDefault() throws IOException { - return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular + return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular } - + public Font get(int family, int style) throws IOException { Font font = (Font)fontMap.get( ( family << 8 ) | style ); if (font != null) { @@ -97,7 +97,7 @@ public class UbuntuFontLoader implements FontSet { font = abspath(availableFontFileNames[0], family, style); } break; - + case FAMILY_LIGHT: if( is(style, STYLE_ITALIC) ) { font = abspath(availableFontFileNames[5], family, style); @@ -105,19 +105,19 @@ public class UbuntuFontLoader implements FontSet { font = abspath(availableFontFileNames[4], family, style); } break; - + case FAMILY_MEDIUM: if( is(style, STYLE_ITALIC) ) { font = abspath(availableFontFileNames[6], family, style); } else { font = abspath(availableFontFileNames[7], family, style); } - break; + break; } return font; } - + Font abspath(String fname, int family, int style) throws IOException { final String err = "Problem loading font "+fname+", stream "+relPath+fname; try { @@ -129,10 +129,10 @@ public class UbuntuFontLoader implements FontSet { if(null != f) { fontMap.put( ( family << 8 ) | style, f ); return f; - } + } throw new IOException(err); } catch(IOException ioe) { - throw new IOException(err, ioe); + throw new IOException(err, ioe); } - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index 0441bf836..ba6c72650 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -51,20 +51,20 @@ import com.jogamp.opengl.math.geom.AABBox; class TypecastFont implements FontInt { static final boolean DEBUG = false; - + final OTFontCollection fontset; final OTFont font; TypecastHMetrics metrics; final CmapFormat cmapFormat; int cmapentries; - - // FIXME: Add cache size to limit memory usage ?? - IntObjectHashMap char2Glyph; + + // FIXME: Add cache size to limit memory usage ?? + IntObjectHashMap char2Glyph; public TypecastFont(OTFontCollection fontset) { this.fontset = fontset; this.font = fontset.getFont(0); - + // FIXME: Generic attempt to find the best CmapTable, // which is assumed to be the one with the most entries (stupid 'eh?) CmapTable cmapTable = font.getCmapTable(); @@ -77,14 +77,14 @@ class TypecastFont implements FontInt { int pidx = cmapIdxEntry.getPlatformId(); CmapFormat cf = cmapIdxEntry.getFormat(); if(DEBUG) { - System.err.println("CmapFormat["+i+"]: platform " + pidx + + System.err.println("CmapFormat["+i+"]: platform " + pidx + ", encoding "+cmapIdxEntry.getEncodingId() + ": "+cf); } - if( _cmapFormatP[pidx] == null || + if( _cmapFormatP[pidx] == null || _cmapFormatP[pidx].getLength() < cf.getLength() ) { _cmapFormatP[pidx] = cf; if( cf.getLength() > platformLength ) { - platformLength = cf.getLength() ; + platformLength = cf.getLength() ; platform = pidx; encoding = cmapIdxEntry.getEncodingId(); } @@ -93,10 +93,10 @@ class TypecastFont implements FontInt { if(0 <= platform) { cmapFormat = _cmapFormatP[platform]; if(DEBUG) { - System.err.println("Selected CmapFormat: platform " + platform + + System.err.println("Selected CmapFormat: platform " + platform + ", encoding "+encoding + ": "+cmapFormat); } - } else { + } else { CmapFormat _cmapFormat = null; /*if(null == _cmapFormat) { platform = ID.platformMacintosh; @@ -127,14 +127,14 @@ class TypecastFont implements FontInt { cmapentries = 0; for (int i = 0; i < cmapFormat.getRangeCount(); ++i) { CmapFormat.Range range = cmapFormat.getRange(i); - cmapentries += range.getEndCode() - range.getStartCode() + 1; // end included - } + cmapentries += range.getEndCode() - range.getStartCode() + 1; // end included + } if(DEBUG) { System.err.println("font direction hint: "+font.getHeadTable().getFontDirectionHint()); System.err.println("num glyphs: "+font.getNumGlyphs()); System.err.println("num cmap entries: "+cmapentries); System.err.println("num cmap ranges: "+cmapFormat.getRangeCount()); - + for (int i = 0; i < cmapFormat.getRangeCount(); ++i) { CmapFormat.Range range = cmapFormat.getRange(i); for (int j = range.getStartCode(); j <= range.getEndCode(); ++j) { @@ -147,7 +147,7 @@ class TypecastFont implements FontInt { } char2Glyph = new IntObjectHashMap(cmapentries + cmapentries/4); } - + public StringBuilder getName(StringBuilder sb, int nameIndex) { return font.getName(nameIndex, sb); } @@ -161,12 +161,12 @@ class TypecastFont implements FontInt { sb = getName(sb, Font.NAME_FAMILY).append("-"); getName(sb, Font.NAME_SUBFAMILY); return sb; - } + } public float getAdvanceWidth(int i, float pixelSize) { - return font.getHmtxTable().getAdvanceWidth(i) * metrics.getScale(pixelSize); + return font.getHmtxTable().getAdvanceWidth(i) * metrics.getScale(pixelSize); } - + public Metrics getMetrics() { if (metrics == null) { metrics = new TypecastHMetrics(this); @@ -175,7 +175,7 @@ class TypecastFont implements FontInt { } public Glyph getGlyph(char symbol) { - TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol); + TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol); if (null == result) { // final short code = (short) char2Code.get(symbol); short code = (short) cmapFormat.mapCharCode(symbol); @@ -187,7 +187,7 @@ class TypecastFont implements FontInt { default: code = Glyph.ID_UNKNOWN; } } - + jogamp.graph.font.typecast.ot.OTGlyph glyph = font.getGlyph(code); if(null == glyph) { glyph = font.getGlyph(Glyph.ID_UNKNOWN); @@ -200,25 +200,25 @@ class TypecastFont implements FontInt { if(DEBUG) { System.err.println("New glyph: " + (int)symbol + " ( " + (char)symbol +" ) -> " + code + ", contours " + glyph.getPointCount() + ": " + path); } - final HdmxTable hdmx = font.getHdmxTable(); + final HdmxTable hdmx = font.getHdmxTable(); if (null!= result && null != hdmx) { /*if(DEBUG) { System.err.println("hdmx "+hdmx); }*/ for (int i=0; i<hdmx.getNumberOfRecords(); i++) { - final HdmxTable.DeviceRecord dr = hdmx.getRecord(i); + final HdmxTable.DeviceRecord dr = hdmx.getRecord(i); result.addAdvance(dr.getWidth(code), dr.getPixelSize()); /* if(DEBUG) { System.err.println("hdmx advance : pixelsize = "+dr.getWidth(code)+" : "+ dr.getPixelSize()); } */ } - } + } char2Glyph.put(symbol, result); } return result; } - + public ArrayList<OutlineShape> getOutlineShapes(CharSequence string, float pixelSize, Factory<? extends Vertex> vertexFactory) { AffineTransform transform = new AffineTransform(vertexFactory); return TypecastRenderer.getOutlineShapes(this, string, pixelSize, transform, vertexFactory); @@ -238,7 +238,7 @@ class TypecastFont implements FontInt { } } - return (int)(width + 0.5f); + return (int)(width + 0.5f); } public float getStringHeight(CharSequence string, float pixelSize) { @@ -254,7 +254,7 @@ class TypecastFont implements FontInt { height = (int)Math.ceil(Math.max(bbox.getHeight(), height)); } } - return height; + return height; } public AABBox getStringBounds(CharSequence string, float pixelSize) { @@ -284,17 +284,17 @@ class TypecastFont implements FontInt { totalHeight -= advanceY; totalWidth = Math.max(curLineWidth, totalWidth); } - return new AABBox(0, 0, 0, totalWidth, totalHeight,0); + return new AABBox(0, 0, 0, totalWidth, totalHeight,0); } final public int getNumGlyphs() { return font.getNumGlyphs(); } - + public boolean isPrintableChar( char c ) { return FontFactory.isPrintableChar(c); } - + public String toString() { return getFullFamilyName(null).toString(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java index 8479c08ca..77b5a9aa9 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java @@ -46,7 +46,7 @@ public class TypecastFontConstructor implements FontConstructor { public Font create(final File ffile) throws IOException { Object o = AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { - OTFontCollection fontset; + OTFontCollection fontset; try { fontset = OTFontCollection.create(ffile); return new TypecastFont(fontset); @@ -63,14 +63,14 @@ public class TypecastFontConstructor implements FontConstructor { } throw new InternalError("Unexpected Object: "+o); } - + public Font create(final URLConnection fconn) throws IOException { return AccessController.doPrivileged(new PrivilegedAction<Font>() { public Font run() { File tf = null; int len=0; Font f = null; - try { + try { tf = IOUtil.createTempFile( "jogl.font", ".ttf", false); len = IOUtil.copyURLConn2File(fconn, tf); if(len==0) { @@ -84,7 +84,7 @@ public class TypecastFontConstructor implements FontConstructor { } return f; } - }); + }); } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java index 1205c6539..476b3fd4e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java @@ -40,45 +40,45 @@ public class TypecastGlyph implements FontInt.GlyphInt { public class Advance { final Font font; - final float advance; - HashMap<Float, Float> size2advance = new HashMap<Float, Float>(); - + final float advance; + HashMap<Float, Float> size2advance = new HashMap<Float, Float>(); + public Advance(Font font, float advance) { this.font = font; this.advance = advance; } - + public void reset() { size2advance.clear(); } - + public float getScale(float pixelSize) { return this.font.getMetrics().getScale(pixelSize); } - + public void add(float advance, float size) { size2advance.put(size, advance); } - + public float get(float size, boolean useFrationalMetrics) { Float fo = size2advance.get(size); - if(null == fo) { + if(null == fo) { float value = (this.advance * getScale(size)); if (useFrationalMetrics == false) { //value = (float)Math.ceil(value); // value = (int)value; - value = (int) ( value + 0.5f ) ; // TODO: check + value = (int) ( value + 0.5f ) ; // TODO: check } size2advance.put(size, value); return value; } return fo.floatValue(); } - + public String toString() { return "\nAdvance:"+ @@ -86,147 +86,147 @@ public class TypecastGlyph implements FontInt.GlyphInt { "\n advances: \n"+size2advance; } } - + public class Metrics { AABBox bbox; Advance advance; - + public Metrics(Font font, AABBox bbox, float advance) { this.bbox = bbox; this.advance = new Advance(font, advance); } - + public void reset() { advance.reset(); } - + public float getScale(float pixelSize) { return this.advance.getScale(pixelSize); } - + public AABBox getBBox() { return this.bbox; } - + public void addAdvance(float advance, float size) { this.advance.add(advance, size); } - + public float getAdvance(float size, boolean useFrationalMetrics) { return this.advance.get(size, useFrationalMetrics); } - + public String toString() { return "\nMetrics:"+ "\n bbox: "+this.bbox+ this.advance; } - } + } public static final short INVALID_ID = (short)((1 << 16) - 1); public static final short MAX_ID = (short)((1 << 16) - 2); - + private final Font font; - + char symbol; short id; int advance; Metrics metrics; - + protected Path2D path; // in EM units protected Path2D pathSized; protected float numberSized; - + protected TypecastGlyph(Font font, char symbol) { this.font = font; this.symbol = symbol; } - + protected TypecastGlyph(Font font, char symbol, short id, AABBox bbox, int advance, Path2D path) { this.font = font; this.symbol = symbol; this.advance = advance; - + init(id, bbox, advance); - + this.path = path; this.pathSized = null; this.numberSized = 0.0f; } - + void init(short id, AABBox bbox, int advance) { this.id = id; this.advance = advance; this.metrics = new Metrics(this.font, bbox, this.advance); } - + public void reset(Path2D path) { this.path = path; this.metrics.reset(); } - + public Font getFont() { return this.font; } - + public char getSymbol() { return this.symbol; } - + AABBox getBBoxUnsized() { return this.metrics.getBBox(); } - + public AABBox getBBox() { return this.metrics.getBBox(); } - + public Metrics getMetrics() { return this.metrics; } - + public short getID() { return this.id; } - + public float getScale(float pixelSize) { return this.metrics.getScale(pixelSize); } - + public AABBox getBBox(float pixelSize) { final float size = getScale(pixelSize); AABBox newBox = getBBox().clone(); newBox.scale(size); - return newBox; + return newBox; } - + protected void addAdvance(float advance, float size) { this.metrics.addAdvance(advance, size); } - + public float getAdvance(float pixelSize, boolean useFrationalMetrics) { return this.metrics.getAdvance(pixelSize, useFrationalMetrics); } - + public Path2D getPath() { return this.path; } - + public Path2D getPath(float pixelSize) { final float size = getScale(pixelSize); - + if (this.numberSized != size) { this.numberSized = size; this.pathSized = AffineTransform.getScaleInstance(null, size, size).createTransformedShape(getPath()); - } + } return this.pathSized; - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java index f170f5819..a6ce58ae2 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.math.geom.AABBox; class TypecastHMetrics implements Metrics { private final TypecastFont fontImpl; - + // HeadTable private final HeadTable headTable; private final float unitsPerEM_Inv; @@ -44,23 +44,23 @@ class TypecastHMetrics implements Metrics { private final HheaTable hheaTable; // VheaTable (for horizontal fonts) // private final VheaTable vheaTable; - + public TypecastHMetrics(TypecastFont fontImpl) { this.fontImpl = fontImpl; headTable = this.fontImpl.font.getHeadTable(); - hheaTable = this.fontImpl.font.getHheaTable(); + hheaTable = this.fontImpl.font.getHheaTable(); // vheaTable = this.fontImpl.font.getVheaTable(); unitsPerEM_Inv = 1.0f / ( (float) headTable.getUnitsPerEm() ); - + int maxWidth = headTable.getXMax() - headTable.getXMin(); - int maxHeight = headTable.getYMax() - headTable.getYMin(); + int maxHeight = headTable.getYMax() - headTable.getYMin(); float lowx= headTable.getXMin(); float lowy = -(headTable.getYMin()+maxHeight); float highx = lowx + maxWidth; float highy = lowy + maxHeight; bbox = new AABBox(lowx, lowy, 0, highx, highy, 0); // invert } - + public final float getAscent(float pixelSize) { return getScale(pixelSize) * -hheaTable.getAscender(); // invert } @@ -78,7 +78,7 @@ class TypecastHMetrics implements Metrics { } public final AABBox getBBox(float pixelSize) { AABBox res = new AABBox(bbox.getLow(), bbox.getHigh()); - res.scale(getScale(pixelSize)); + res.scale(getScale(pixelSize)); return res; } }
\ No newline at end of file diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java index f155345aa..127e260ca 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java @@ -43,14 +43,14 @@ import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; /** - * Factory to build a {@link com.jogamp.graph.geom.Path2D Path2D} from - * {@link jogamp.graph.font.typecast.ot.OTGlyph Glyph}s. + * Factory to build a {@link com.jogamp.graph.geom.Path2D Path2D} from + * {@link jogamp.graph.font.typecast.ot.OTGlyph Glyph}s. */ public class TypecastRenderer { - private static void getPaths(TypecastFont font, + private static void getPaths(TypecastFont font, CharSequence string, float pixelSize, AffineTransform transform, Path2D[] p) - { + { if (string == null) { return; } @@ -79,14 +79,14 @@ public class TypecastRenderer { } else if (character == ' ') { advanceTotal += font.getAdvanceWidth(Glyph.ID_SPACE, pixelSize); continue; - } + } Glyph glyph = font.getGlyph(character); Path2D gp = ((GlyphInt)glyph).getPath(); float scale = metrics.getScale(pixelSize); t.translate(advanceTotal, y); t.scale(scale, scale); p[i].append(gp.iterator(t), false); - advanceTotal += glyph.getAdvance(pixelSize, true); + advanceTotal += glyph.getAdvance(pixelSize, true); } } @@ -119,19 +119,19 @@ public class TypecastRenderer { case PathIterator.SEG_MOVETO: shape.closeLastOutline(); shape.addEmptyOutline(); - shape.addVertex(0, vertexFactory.create(coords, 0, 2, true)); + shape.addVertex(0, vertexFactory.create(coords, 0, 2, true)); break; case PathIterator.SEG_LINETO: - shape.addVertex(0, vertexFactory.create(coords, 0, 2, true)); + shape.addVertex(0, vertexFactory.create(coords, 0, 2, true)); break; case PathIterator.SEG_QUADTO: shape.addVertex(0, vertexFactory.create(coords, 0, 2, false)); - shape.addVertex(0, vertexFactory.create(coords, 2, 2, true)); + shape.addVertex(0, vertexFactory.create(coords, 2, 2, true)); break; case PathIterator.SEG_CUBICTO: shape.addVertex(0, vertexFactory.create(coords, 0, 2, false)); shape.addVertex(0, vertexFactory.create(coords, 2, 2, false)); - shape.addVertex(0, vertexFactory.create(coords, 4, 2, true)); + shape.addVertex(0, vertexFactory.create(coords, 4, 2, true)); break; case PathIterator.SEG_CLOSE: shape.closeLastOutline(); @@ -184,12 +184,12 @@ public class TypecastRenderer { if (point_plus1.onCurve) { // s = new Line2D.Float(point.x, point.y, point_plus1.x, point_plus1.y); gp.lineTo( point_plus1.x, point_plus1.y ); - offset++; + offset++; } else { if (point_plus2.onCurve) { // s = new QuadCurve2D.Float( point.x, point.y, point_plus1.x, point_plus1.y, point_plus2.x, point_plus2.y); gp.quadTo(point_plus1.x, point_plus1.y, point_plus2.x, point_plus2.y); - offset+=2; + offset+=2; } else { // s = new QuadCurve2D.Float(point.x,point.y,point_plus1.x,point_plus1.y, // midValue(point_plus1.x, point_plus2.x), midValue(point_plus1.y, point_plus2.y)); @@ -210,7 +210,7 @@ public class TypecastRenderer { // midValue(point.x, point_plus1.x), midValue(point.y, point_plus1.y)); //gp.curve3(midValue(point.x, point_plus1.x), midValue(point.y, point_plus1.y), point.x, point.y); gp.quadTo(point.x, point.y, midValue(point.x, point_plus1.x), midValue(point.y, point_plus1.y)); - offset++; + offset++; } } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java index b5535758d..8b685659e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java index ece0aae4b..0a4786f82 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java @@ -840,11 +840,11 @@ public class Fixed { } return n; } - + public static float floatValue(long fixed) { return (fixed >> 16) + (float)(fixed & 0xffff) / 0x10000; } - + public static float roundedFloatValue(long fixed, int decimalPlaces) { int factor = 10 * decimalPlaces; return (float)((int)(floatValue(fixed) * factor)) / factor; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java index 6b3dc1f6f..d6c9da268 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java index 8c14b7302..8fc4be92d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java @@ -104,10 +104,10 @@ public class OTFont { public StringBuilder getName(int nameIndex, StringBuilder sb) { if(null == sb) { sb = new StringBuilder(); - } + } return _name.getRecordsRecordString(sb, nameIndex); } - + public StringBuilder getAllNames(StringBuilder sb, String separator) { if(null != _name) { if(null == sb) { @@ -117,9 +117,9 @@ public class OTFont { _name.getRecord(i).getRecordString(sb).append(separator); } } - return sb; + return sb; } - + public Table getTable(int tableType) { for (int i = 0; i < _tables.length; i++) { if ((_tables[i] != null) && (_tables[i].getType() == tableType)) { @@ -132,31 +132,31 @@ public class OTFont { public Os2Table getOS2Table() { return _os2; } - + public CmapTable getCmapTable() { return _cmap; } - + public HeadTable getHeadTable() { return _head; } - + public HheaTable getHheaTable() { return _hhea; } - + public HdmxTable getHdmxTable() { return _hdmx; } - + public HmtxTable getHmtxTable() { return _hmtx; } - + public LocaTable getLocaTable() { return _loca; } - + public MaxpTable getMaxpTable() { return _maxp; } @@ -186,8 +186,8 @@ public class OTFont { } public OTGlyph getGlyph(int i) { - - final GlyfDescript _glyfDescr = _glyf.getDescription(i); + + final GlyfDescript _glyfDescr = _glyf.getDescription(i); return (null != _glyfDescr) ? new OTGlyph( _glyfDescr, @@ -195,11 +195,11 @@ public class OTFont { _hmtx.getAdvanceWidth(i)) : null; } - + public TableDirectory getTableDirectory() { return _tableDirectory; } - + private Table readTable( DataInputStream dis, int tablesOrigin, @@ -228,13 +228,13 @@ public class OTFont { DataInputStream dis, int directoryOffset, int tablesOrigin) throws IOException { - + // Load the table directory dis.reset(); dis.skip(directoryOffset); _tableDirectory = new TableDirectory(dis); _tables = new Table[_tableDirectory.getNumTables()]; - + // Load some prerequisite tables _head = (HeadTable) readTable(dis, tablesOrigin, Table.head); _hhea = (HheaTable) readTable(dis, tablesOrigin, Table.hhea); @@ -252,7 +252,7 @@ public class OTFont { if (_vhea != null) { _tables[index++] = _vhea; } - + // Load all other tables for (int i = 0; i < _tableDirectory.getNumTables(); i++) { DirectoryEntry entry = _tableDirectory.getEntry(i); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java index 4a041604d..c79380f16 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java @@ -75,11 +75,11 @@ public class OTFontCollection { public OTFont getFont(int i) { return _fonts[i]; } - + public int getFontCount() { return _fonts.length; } - + public TTCHeader getTtcHeader() { return _ttcHeader; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java index 244ab400a..e0d652bd4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java @@ -102,10 +102,10 @@ public class OTGlyph { } } - public AABBox getBBox() { - return _bbox; + public AABBox getBBox() { + return _bbox; } - + public int getAdvanceWidth() { return _advanceWidth; } @@ -163,7 +163,7 @@ public class OTGlyph { // Append the origin and advanceWidth points (n & n+1) // _points[gd.getPointCount()] = new Point(0, 0, true, true); // _points[gd.getPointCount()+1] = new Point(_advanceWidth, 0, true, true); - + _bbox = new AABBox(gd.getXMinimum(), gd.getYMinimum(), 0, gd.getXMaximum(), gd.getYMaximum(), 0); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java index 433ff6051..7a5b0c4d2 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java @@ -31,7 +31,7 @@ import java.io.IOException; public class ResourceData { private byte[] data; - + /** Creates new ResourceData */ public ResourceData(DataInput di) throws IOException { int dataLen = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java index 2ada22c82..468ab2e1c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java @@ -33,14 +33,14 @@ public class ResourceFile { private ResourceHeader header; private ResourceMap map; - + /** Creates new Resource */ public ResourceFile(RandomAccessFile raf) throws IOException { // Read header at the beginning of the file raf.seek(0); header = new ResourceHeader(raf); - + // Seek to the map offset and read the map raf.seek(header.getMapOffset()); map = new ResourceMap(raf); @@ -53,18 +53,18 @@ public class ResourceFile { public static void main(String[] args) { try { //RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/GillSans.dfont", "r"); - + // Tests loading a font from a resource fork on Mac OS X RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/Georgia/..namedfork/rsrc", "r"); ResourceFile resource = new ResourceFile(raf); for (int i = 0; i < resource.getResourceMap().getResourceTypeCount(); i++) { System.out.println(resource.getResourceMap().getResourceType(i).getTypeAsString()); } - + // Get the first 'sfnt' resource ResourceType type = resource.getResourceMap().getResourceType("sfnt"); ResourceReference reference = type.getReference(0); - + type = resource.getResourceMap().getResourceType("FOND"); for (int i = 0; i < type.getCount(); ++i) { reference = type.getReference(i); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java index 8f5224632..de13b116f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java @@ -46,15 +46,15 @@ public class ResourceHeader { public int getDataOffset() { return dataOffset; } - + public int getMapOffset() { return mapOffset; } - + public int getDataLength() { return dataLen; } - + public int getMapLength() { return mapLen; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java index 96ba06087..d348c645e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java @@ -35,7 +35,7 @@ public class ResourceMap { private int fileReferenceNumber; private int attributes; private ResourceType[] types; - + /** Creates new ResourceMap */ public ResourceMap(DataInput di) throws IOException { di.readFully(headerCopy); @@ -45,18 +45,18 @@ public class ResourceMap { int typeOffset = di.readUnsignedShort(); int nameOffset = di.readUnsignedShort(); int typeCount = di.readUnsignedShort() + 1; - + // Read types types = new ResourceType[typeCount]; for (int i = 0; i < typeCount; i++) { types[i] = new ResourceType(di); } - + // Read the references for (int i = 0; i < typeCount; i++) { types[i].readRefs(di); } - + // Read the names for (int i = 0; i < typeCount; i++) { types[i].readNames(di); @@ -76,7 +76,7 @@ public class ResourceMap { public ResourceType getResourceType(int i) { return types[i]; } - + public int getResourceTypeCount() { return types.length; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java index fd7ec46b2..9d1534821 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java @@ -36,7 +36,7 @@ public class ResourceReference { private int dataOffset; private int handle; private String name; - + /** Creates new ResourceReference */ protected ResourceReference(DataInput di) throws IOException { id = di.readUnsignedShort(); @@ -58,23 +58,23 @@ public class ResourceReference { public int getId() { return id; } - + public short getNameOffset() { return nameOffset; } - + public short getAttributes() { return attributes; } - + public int getDataOffset() { return dataOffset; } - + public int getHandle() { return handle; } - + public String getName() { return name; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java index 1c7e24c0f..2ad002e6a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java @@ -34,7 +34,7 @@ public class ResourceType { private int count; private int offset; private ResourceReference[] references; - + /** Creates new ResourceType */ protected ResourceType(DataInput di) throws IOException { type = di.readInt(); @@ -42,7 +42,7 @@ public class ResourceType { offset = di.readUnsignedShort(); references = new ResourceReference[count]; } - + protected void readRefs(DataInput di) throws IOException { for (int i = 0; i < count; i++) { references[i] = new ResourceReference(di); @@ -58,7 +58,7 @@ public class ResourceType { public int getType() { return type; } - + public String getTypeAsString() { return new StringBuilder() .append((char)((type>>24)&0xff)) @@ -67,11 +67,11 @@ public class ResourceType { .append((char)((type)&0xff)) .toString(); } - + public int getCount() { return count; } - + public int getOffset() { return offset; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java index ed615eb72..b6626a9cc 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java @@ -31,18 +31,18 @@ import java.io.IOException; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public class BaseTable implements Table { - + private abstract class BaseCoord { public abstract int getBaseCoordFormat(); - + public abstract short getCoordinate(); } - + private class BaseCoordFormat1 extends BaseCoord { private short _coordinate; - + protected BaseCoordFormat1(DataInput di) throws IOException { _coordinate = di.readShort(); } @@ -50,19 +50,19 @@ public class BaseTable implements Table { public int getBaseCoordFormat() { return 1; } - + public short getCoordinate() { return _coordinate; } - + } - + private class BaseCoordFormat2 extends BaseCoord { private short _coordinate; private int _referenceGlyph; private int _baseCoordPoint; - + protected BaseCoordFormat2(DataInput di) throws IOException { _coordinate = di.readShort(); _referenceGlyph = di.readUnsignedShort(); @@ -72,18 +72,18 @@ public class BaseTable implements Table { public int getBaseCoordFormat() { return 2; } - + public short getCoordinate() { return _coordinate; } - + } - + private class BaseCoordFormat3 extends BaseCoord { private short _coordinate; private int _deviceTableOffset; - + protected BaseCoordFormat3(DataInput di) throws IOException { _coordinate = di.readShort(); _deviceTableOffset = di.readUnsignedShort(); @@ -92,33 +92,33 @@ public class BaseTable implements Table { public int getBaseCoordFormat() { return 2; } - + public short getCoordinate() { return _coordinate; } - + } - + private class FeatMinMaxRecord { - + private int _tag; private int _minCoordOffset; private int _maxCoordOffset; - + protected FeatMinMaxRecord(DataInput di) throws IOException { _tag = di.readInt(); _minCoordOffset = di.readUnsignedShort(); _maxCoordOffset = di.readUnsignedShort(); } } - + private class MinMax { - + private int _minCoordOffset; private int _maxCoordOffset; private int _featMinMaxCount; private FeatMinMaxRecord[] _featMinMaxRecord; - + protected MinMax(int minMaxOffset) throws IOException { DataInput di = getDataInputForOffset(minMaxOffset); _minCoordOffset = di.readUnsignedShort(); @@ -130,14 +130,14 @@ public class BaseTable implements Table { } } } - + private class BaseValues { - + private int _defaultIndex; private int _baseCoordCount; private int[] _baseCoordOffset; private BaseCoord[] _baseCoords; - + protected BaseValues(int baseValuesOffset) throws IOException { DataInput di = getDataInputForOffset(baseValuesOffset); _defaultIndex = di.readUnsignedShort(); @@ -163,12 +163,12 @@ public class BaseTable implements Table { } } } - + private class BaseLangSysRecord { - + private int _baseLangSysTag; private int _minMaxOffset; - + protected BaseLangSysRecord(DataInput di) throws IOException { _baseLangSysTag = di.readInt(); _minMaxOffset = di.readUnsignedShort(); @@ -177,14 +177,14 @@ public class BaseTable implements Table { public int getBaseLangSysTag() { return _baseLangSysTag; } - + public int getMinMaxOffset() { return _minMaxOffset; } } - + private class BaseScript { - + private int _thisOffset; private int _baseValuesOffset; private int _defaultMinMaxOffset; @@ -192,7 +192,7 @@ public class BaseTable implements Table { private BaseLangSysRecord[] _baseLangSysRecord; private BaseValues _baseValues; private MinMax[] _minMax; - + protected BaseScript(int baseScriptOffset) throws IOException { _thisOffset = baseScriptOffset; DataInput di = getDataInputForOffset(baseScriptOffset); @@ -231,9 +231,9 @@ public class BaseTable implements Table { return sb.toString(); } } - + private class BaseScriptRecord { - + private int _baseScriptTag; private int _baseScriptOffset; @@ -245,19 +245,19 @@ public class BaseTable implements Table { public int getBaseScriptTag() { return _baseScriptTag; } - + public int getBaseScriptOffset() { return _baseScriptOffset; } } - + private class BaseScriptList { - + private int _thisOffset; private int _baseScriptCount; private BaseScriptRecord[] _baseScriptRecord; private BaseScript[] _baseScripts; - + protected BaseScriptList(int baseScriptListOffset) throws IOException { _thisOffset = baseScriptListOffset; DataInput di = getDataInputForOffset(baseScriptListOffset); @@ -288,13 +288,13 @@ public class BaseTable implements Table { return sb.toString(); } } - + private class BaseTagList { - + private int _thisOffset; private int _baseTagCount; private int[] _baselineTag; - + protected BaseTagList(int baseTagListOffset) throws IOException { _thisOffset = baseTagListOffset; DataInput di = getDataInputForOffset(baseTagListOffset); @@ -315,9 +315,9 @@ public class BaseTable implements Table { return sb.toString(); } } - + private class Axis { - + private int _thisOffset; private int _baseTagListOffset; private int _baseScriptListOffset; @@ -348,7 +348,7 @@ public class BaseTable implements Table { .toString(); } } - + private DirectoryEntry _de; private int _version; private int _horizAxisOffset; @@ -375,25 +375,25 @@ public class BaseTable implements Table { if (_vertAxisOffset != 0) { _vertAxis = new Axis(_vertAxisOffset); } - + // Let go of the buffer _buf = null; } - + private DataInput getDataInputForOffset(int offset) { return new DataInputStream(new ByteArrayInputStream( _buf, offset, _de.getLength() - offset)); } - + // private String valueAsShortHex(int value) { // return String.format("%1$4x", value); // } -// +// // private String valueAsLongHex(int value) { // return String.format("%1$8x", value); // } - + static protected String tagAsString(int tag) { char[] c = new char[4]; c[0] = (char)((tag >> 24) & 0xff); @@ -402,7 +402,7 @@ public class BaseTable implements Table { c[3] = (char)(tag & 0xff); return String.valueOf(c); } - + public int getType() { return BASE; } @@ -422,7 +422,7 @@ public class BaseTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java index 966f6e17b..62486fb7f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java @@ -36,13 +36,13 @@ import java.util.Hashtable; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public class CffTable implements Table { - + public class Dict { - + private Dictionary<Integer, Object> _entries = new Hashtable<Integer, Object>(); private int[] _data; private int _index; - + protected Dict(int[] data, int offset, int length) { _data = data; _index = offset; @@ -50,11 +50,11 @@ public class CffTable implements Table { addKeyAndValueEntry(); } } - + public Object getValue(int key) { return _entries.get(key); } - + private boolean addKeyAndValueEntry() { ArrayList<Object> operands = new ArrayList<Object>(); Object operand = null; @@ -74,7 +74,7 @@ public class CffTable implements Table { } return true; } - + private boolean isOperandAtIndex() { int b0 = _data[_index]; if ((32 <= b0 && b0 <= 254) @@ -97,31 +97,31 @@ public class CffTable implements Table { private Object nextOperand() { int b0 = _data[_index]; if (32 <= b0 && b0 <= 246) { - + // 1 byte integer ++_index; return new Integer(b0 - 139); } else if (247 <= b0 && b0 <= 250) { - + // 2 byte integer int b1 = _data[_index + 1]; _index += 2; return new Integer((b0 - 247) * 256 + b1 + 108); } else if (251 <= b0 && b0 <= 254) { - + // 2 byte integer int b1 = _data[_index + 1]; _index += 2; return new Integer(-(b0 - 251) * 256 - b1 - 108); } else if (b0 == 28) { - + // 3 byte integer int b1 = _data[_index + 1]; int b2 = _data[_index + 2]; _index += 3; return new Integer(b1 << 8 | b2); } else if (b0 == 29) { - + // 5 byte integer int b1 = _data[_index + 1]; int b2 = _data[_index + 2]; @@ -130,7 +130,7 @@ public class CffTable implements Table { _index += 5; return new Integer(b1 << 24 | b2 << 16 | b3 << 8 | b4); } else if (b0 == 30) { - + // Real number StringBuilder fString = new StringBuilder(); int nibble1 = 0; @@ -142,13 +142,13 @@ public class CffTable implements Table { ++_index; fString.append(decodeRealNibble(nibble1)); fString.append(decodeRealNibble(nibble2)); - } + } return new Float(fString.toString()); } else { return null; } } - + private String decodeRealNibble(int nibble) { if (nibble < 0xa) { return Integer.toString(nibble); @@ -163,7 +163,7 @@ public class CffTable implements Table { } return ""; } - + public String toString() { StringBuilder sb = new StringBuilder(); Enumeration<Integer> keys = _entries.keys(); @@ -179,14 +179,14 @@ public class CffTable implements Table { return sb.toString(); } } - + public class Index { - + private int _count; private int _offSize; private int[] _offset; private int[] _data; - + protected Index(DataInput di) throws IOException { _count = di.readUnsignedShort(); _offset = new int[_count + 1]; @@ -203,19 +203,19 @@ public class CffTable implements Table { _data[i] = di.readUnsignedByte(); } } - + public int getCount() { return _count; } - + public int getOffset(int index) { return _offset[index]; } - + public int getDataLength() { return _offset[_offset.length - 1] - 1; } - + public int[] getData() { return _data; } @@ -241,13 +241,13 @@ public class CffTable implements Table { return sb.toString(); } } - + public class TopDictIndex extends Index { protected TopDictIndex(DataInput di) throws IOException { super(di); } - + public Dict getTopDict(int index) { int offset = getOffset(index) - 1; int len = getOffset(index + 1) - offset - 1; @@ -262,13 +262,13 @@ public class CffTable implements Table { return sb.toString(); } } - + public class NameIndex extends Index { protected NameIndex(DataInput di) throws IOException { super(di); } - + public String getName(int index) { String name = null; int offset = getOffset(index) - 1; @@ -286,7 +286,7 @@ public class CffTable implements Table { } return name; } - + public String toString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < getCount(); ++i) { @@ -301,7 +301,7 @@ public class CffTable implements Table { protected StringIndex(DataInput di) throws IOException { super(di); } - + public String getString(int index) { if (index < CffStandardStrings.standardStrings.length) { return CffStandardStrings.standardStrings[index]; @@ -320,7 +320,7 @@ public class CffTable implements Table { return sb.toString(); } } - + public String toString() { int nonStandardBase = CffStandardStrings.standardStrings.length; StringBuilder sb = new StringBuilder(); @@ -331,12 +331,12 @@ public class CffTable implements Table { return sb.toString(); } } - + private class CharsetRange { - + private int _first; private int _left; - + public int getFirst() { return _first; } @@ -344,7 +344,7 @@ public class CffTable implements Table { protected void setFirst(int first) { _first = first; } - + public int getLeft() { return _left; } @@ -355,39 +355,39 @@ public class CffTable implements Table { } private class CharsetRange1 extends CharsetRange { - + protected CharsetRange1(DataInput di) throws IOException { setFirst(di.readUnsignedShort()); setLeft(di.readUnsignedByte()); } } - + private class CharsetRange2 extends CharsetRange { - + protected CharsetRange2(DataInput di) throws IOException { setFirst(di.readUnsignedShort()); setLeft(di.readUnsignedShort()); } } - + private abstract class Charset { - + public abstract int getFormat(); - + public abstract int getSID(int gid); } - + private class CharsetFormat0 extends Charset { - + private int[] _glyph; - + protected CharsetFormat0(DataInput di, int glyphCount) throws IOException { _glyph = new int[glyphCount - 1]; // minus 1 because .notdef is omitted for (int i = 0; i < glyphCount - 1; ++i) { _glyph[i] = di.readUnsignedShort(); } } - + public int getFormat() { return 0; } @@ -399,11 +399,11 @@ public class CffTable implements Table { return _glyph[gid - 1]; } } - + private class CharsetFormat1 extends Charset { - + private ArrayList<CharsetRange> _charsetRanges = new ArrayList<CharsetRange>(); - + protected CharsetFormat1(DataInput di, int glyphCount) throws IOException { int glyphsCovered = glyphCount - 1; // minus 1 because .notdef is omitted while (glyphsCovered > 0) { @@ -421,7 +421,7 @@ public class CffTable implements Table { if (gid == 0) { return 0; } - + // Count through the ranges to find the one of interest int count = 0; for (CharsetRange range : _charsetRanges) { @@ -436,9 +436,9 @@ public class CffTable implements Table { } private class CharsetFormat2 extends Charset { - + private ArrayList<CharsetRange> _charsetRanges = new ArrayList<CharsetRange>(); - + protected CharsetFormat2(DataInput di, int glyphCount) throws IOException { int glyphsCovered = glyphCount - 1; // minus 1 because .notdef is omitted while (glyphsCovered > 0) { @@ -456,7 +456,7 @@ public class CffTable implements Table { if (gid == 0) { return 0; } - + // Count through the ranges to find the one of interest int count = 0; for (CharsetRange range : _charsetRanges) { @@ -469,7 +469,7 @@ public class CffTable implements Table { return 0; } } - + private DirectoryEntry _de; private int _major; private int _minor; @@ -499,24 +499,24 @@ public class CffTable implements Table { _minor = di2.readUnsignedByte(); _hdrSize = di2.readUnsignedByte(); _offSize = di2.readUnsignedByte(); - + // Name INDEX di2 = getDataInputForOffset(_hdrSize); _nameIndex = new NameIndex(di2); - + // Top DICT INDEX _topDictIndex = new TopDictIndex(di2); // String INDEX _stringIndex = new StringIndex(di2); - + // Global Subr INDEX _globalSubrIndex = new Index(di2); - + // Encodings go here -- but since this is an OpenType font will this // not always be a CIDFont? In which case there are no encodings // within the CFF data. - + // Load each of the fonts _charStringsIndexArray = new Index[_topDictIndex.getCount()]; _charsets = new Charset[_topDictIndex.getCount()]; @@ -530,7 +530,7 @@ public class CffTable implements Table { di2 = getDataInputForOffset(charStringsOffset); _charStringsIndexArray[i] = new Index(di2); int glyphCount = _charStringsIndexArray[i].getCount(); - + // Charsets Integer charsetOffset = (Integer) _topDictIndex.getTopDict(i).getValue(15); di2 = getDataInputForOffset(charsetOffset); @@ -563,7 +563,7 @@ public class CffTable implements Table { } } } - + private DataInput getDataInputForOffset(int offset) { return new DataInputStream(new ByteArrayInputStream( _buf, offset, @@ -573,7 +573,7 @@ public class CffTable implements Table { public NameIndex getNameIndex() { return _nameIndex; } - + public Charset getCharset(int fontIndex) { return _charsets[fontIndex]; } @@ -581,7 +581,7 @@ public class CffTable implements Table { public Charstring getCharstring(int fontIndex, int gid) { return _charstringsArray[fontIndex][gid]; } - + public int getCharstringCount(int fontIndex) { return _charstringsArray[fontIndex].length; } @@ -607,7 +607,7 @@ public class CffTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java index d411d1e00..01e2d4934 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java @@ -28,6 +28,6 @@ package jogamp.graph.font.typecast.ot.table; public abstract class Charstring { public abstract int getIndex(); - + public abstract String getName(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java index 9c40a0e5e..93ff60988 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java @@ -28,7 +28,7 @@ import jogamp.graph.font.typecast.ot.table.CffTable; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public class CharstringType2 extends Charstring { - + private static final String[] _oneByteOperators = { "-Reserved-", "hstem", @@ -105,7 +105,7 @@ public class CharstringType2 extends Charstring { "flex1", "-Reserved-" }; - + private int _index; private String _name; private int[] _data; @@ -132,7 +132,7 @@ public class CharstringType2 extends Charstring { _localSubrIndex = localSubrIndex; _globalSubrIndex = globalSubrIndex; } - + public int getIndex() { return _index; } @@ -140,7 +140,7 @@ public class CharstringType2 extends Charstring { public String getName() { return _name; } - + private void disassemble(StringBuilder sb) { Number operand = null; while (isOperandAtIndex()) { @@ -151,7 +151,7 @@ public class CharstringType2 extends Charstring { String mnemonic; if (operator == 12) { operator = nextByte(); - + // Check we're not exceeding the upper limit of our mnemonics if (operator > 38) { operator = 38; @@ -162,7 +162,7 @@ public class CharstringType2 extends Charstring { } sb.append(mnemonic); } - + public void resetIP() { _ip = _offset; } @@ -214,15 +214,15 @@ public class CharstringType2 extends Charstring { return null; } } - + public int nextByte() { return _data[_ip++]; } - + public boolean moreBytes() { return _ip < _offset + _length; } - + public String toString() { StringBuilder sb = new StringBuilder(); resetIP(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java index 4c2f3decb..21698c76b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java index 0c99ad66a..1079aeed4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java index 5b7c4d655..59bc7b329 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java index 7ce531cd9..62ce5ae4c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java @@ -58,21 +58,21 @@ import java.io.IOException; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public abstract class CmapFormat { - + public class Range { - + private int _startCode; private int _endCode; - + protected Range(int startCode, int endCode) { _startCode = startCode; _endCode = endCode; } - + public int getStartCode() { return _startCode; } - + public int getEndCode() { return _endCode; } @@ -116,12 +116,12 @@ public abstract class CmapFormat { } public abstract int getRangeCount(); - + public abstract Range getRange(int index) throws ArrayIndexOutOfBoundsException; public abstract int mapCharCode(int charCode); - + public String toString() { return new StringBuilder() .append("format: ") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java index e374f82d2..2093158bd 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java @@ -74,7 +74,7 @@ public class CmapFormat0 extends CmapFormat { public int getRangeCount() { return 1; } - + public Range getRange(int index) throws ArrayIndexOutOfBoundsException { if (index != 0) { throw new ArrayIndexOutOfBoundsException(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java index 319d8c0d0..222c93852 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java @@ -67,7 +67,7 @@ public class CmapFormat2 extends CmapFormat { int _idRangeOffset; int _arrayIndex; } - + private int[] _subHeaderKeys = new int[256]; private SubHeader[] _subHeaders; private int[] _glyphIndexArray; @@ -75,9 +75,9 @@ public class CmapFormat2 extends CmapFormat { protected CmapFormat2(DataInput di) throws IOException { super(di); _format = 2; - + int pos = 6; - + // Read the subheader keys, noting the highest value, as this will // determine the number of subheaders to read. int highest = 0; @@ -88,7 +88,7 @@ public class CmapFormat2 extends CmapFormat { } int subHeaderCount = highest / 8 + 1; _subHeaders = new SubHeader[subHeaderCount]; - + // Read the subheaders, once again noting the highest glyphIndexArray // index range. int indexArrayOffset = 8 * subHeaderCount + 518; @@ -99,18 +99,18 @@ public class CmapFormat2 extends CmapFormat { sh._entryCount = di.readUnsignedShort(); sh._idDelta = di.readShort(); sh._idRangeOffset = di.readUnsignedShort(); - + // Calculate the offset into the _glyphIndexArray pos += 8; sh._arrayIndex = (pos - 2 + sh._idRangeOffset - indexArrayOffset) / 2; - + // What is the highest range within the glyphIndexArray? highest = Math.max(highest, sh._arrayIndex + sh._entryCount); - + _subHeaders[i] = sh; } - + // Read the glyphIndexArray _glyphIndexArray = new int[highest]; for (int i = 0; i < _glyphIndexArray.length; ++i) { @@ -121,12 +121,12 @@ public class CmapFormat2 extends CmapFormat { public int getRangeCount() { return _subHeaders.length; } - + public Range getRange(int index) throws ArrayIndexOutOfBoundsException { if (index < 0 || index >= _subHeaders.length) { throw new ArrayIndexOutOfBoundsException(); } - + // Find the high-byte (if any) int highByte = 0; if (index != 0) { @@ -137,7 +137,7 @@ public class CmapFormat2 extends CmapFormat { } } } - + return new Range( highByte | _subHeaders[index]._firstCode, highByte | (_subHeaders[index]._firstCode + @@ -145,7 +145,7 @@ public class CmapFormat2 extends CmapFormat { } public int mapCharCode(int charCode) { - + // Get the appropriate subheader int index = 0; int highByte = charCode >> 8; @@ -153,14 +153,14 @@ public class CmapFormat2 extends CmapFormat { index = _subHeaderKeys[highByte] / 8; } SubHeader sh = _subHeaders[index]; - + // Is the charCode out-of-range? int lowByte = charCode & 0xff; if (lowByte < sh._firstCode || lowByte >= (sh._firstCode + sh._entryCount)) { return 0; } - + // Now calculate the glyph index int glyphIndex = _glyphIndexArray[sh._arrayIndex + (lowByte - sh._firstCode)]; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java index c09bdc8c3..ef65867af 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java @@ -102,7 +102,7 @@ public class CmapFormat4 extends CmapFormat { for (int i = 0; i < count; i++) { _glyphIdArray[i] = di.readUnsignedShort(); } // + 2*count (8*segCount + 2*count + 18) - + // Are there any padding bytes we need to consume? // int leftover = length - (8*segCount + 2*count + 18); // if (leftover > 0) { @@ -113,7 +113,7 @@ public class CmapFormat4 extends CmapFormat { public int getRangeCount() { return _segCount; } - + public Range getRange(int index) throws ArrayIndexOutOfBoundsException { if (index < 0 || index >= _segCount) { throw new ArrayIndexOutOfBoundsException(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java index a58531d11..a22e33244 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java @@ -67,7 +67,7 @@ public class CmapFormat6 extends CmapFormat { protected CmapFormat6(DataInput di) throws IOException { super(di); _format = 6; - + // HACK: As this is not yet implemented, we need to skip over the bytes // we should be consuming //di.skipBytes(_length - 4); @@ -76,7 +76,7 @@ public class CmapFormat6 extends CmapFormat { public int getRangeCount() { return 0; } - + public Range getRange(int index) throws ArrayIndexOutOfBoundsException { throw new ArrayIndexOutOfBoundsException(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java index 83366b593..3544b6f62 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java @@ -30,12 +30,12 @@ import java.io.IOException; * @version $Id: CmapFormatUnknown.java,v 1.1 2004-12-21 10:21:23 davidsch Exp $ */ public class CmapFormatUnknown extends CmapFormat { - + /** Creates a new instance of CmapFormatUnknown */ protected CmapFormatUnknown(int format, DataInput di) throws IOException { super(di); _format = format; - + // We don't know how to handle this data, so we'll just skip over it di.skipBytes(_length - 4); } @@ -43,7 +43,7 @@ public class CmapFormatUnknown extends CmapFormat { public int getRangeCount() { return 0; } - + public Range getRange(int index) throws ArrayIndexOutOfBoundsException { throw new ArrayIndexOutOfBoundsException(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java index 85fdf7225..47f6c470d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java @@ -85,7 +85,7 @@ public class CmapIndexEntry implements Comparable { public CmapFormat getFormat() { return _format; } - + public void setFormat(CmapFormat format) { _format = format; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java index 0050fdd8e..016efa093 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java @@ -94,7 +94,7 @@ public class CmapTable implements Table { } else if (_entries[i].getOffset() > bytesRead) { di.skipBytes(_entries[i].getOffset() - (int) bytesRead); } else if (_entries[i].getOffset() != bytesRead) { - + // Something is amiss throw new IOException(); } @@ -109,15 +109,15 @@ public class CmapTable implements Table { public int getVersion() { return _version; } - + public int getNumTables() { return _numTables; } - + public CmapIndexEntry getCmapIndexEntry(int i) { return _entries[i]; } - + public CmapFormat getCmapFormat(short platformId, short encodingId) { // Find the requested format @@ -148,7 +148,7 @@ public class CmapTable implements Table { // } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java index e85fadb5e..4f526f51d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java @@ -68,7 +68,7 @@ public abstract class Coverage { * can't be found. */ public abstract int findGlyph(int glyphId); - + protected static Coverage read(DataInput di) throws IOException { Coverage c = null; int format = di.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java index 963163584..867ef1823 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -47,7 +47,7 @@ public class CvtTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -57,5 +57,5 @@ public class CvtTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java index 6b4af6908..5451f4502 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java index c98f03fe9..7abcec0ce 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java @@ -70,7 +70,7 @@ public class DirectoryEntry implements Cloneable { _offset = di.readInt(); _length = di.readInt(); } - + public Object clone() { try { return super.clone(); @@ -103,7 +103,7 @@ public class DirectoryEntry implements Cloneable { .append((char)((_tag)&0xff)) .toString(); } - + public String toString() { return new StringBuilder() .append("'").append(getTagAsString()) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java index 4b41f451d..4a09a4c34 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -21,7 +21,7 @@ public class DsigEntry { private int format; private int length; private int offset; - + /** Creates new DsigEntry */ protected DsigEntry(DataInput di) throws IOException { format = di.readInt(); @@ -32,11 +32,11 @@ public class DsigEntry { public int getFormat() { return format; } - + public int getLength() { return length; } - + public int getOffset() { return offset; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java index e2784f9e6..f25c595d0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -48,7 +48,7 @@ public class DsigTable implements Table { public int getType() { return DSIG; } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -58,7 +58,7 @@ public class DsigTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + public String toString() { StringBuilder sb = new StringBuilder().append("DSIG\n"); for (int i = 0; i < numSigs; i++) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java index 3cfb54a38..fdedca94a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java @@ -66,11 +66,11 @@ public class FeatureList { /** Creates new FeatureList */ public FeatureList(DataInputStream dis, int offset) throws IOException { - + // Ensure we're in the right place dis.reset(); dis.skipBytes(offset); - + // Start reading _featureCount = dis.readUnsignedShort(); _featureRecords = new FeatureRecord[_featureCount]; @@ -88,11 +88,11 @@ public class FeatureList { public int getFeatureCount() { return _featureCount; } - + public FeatureRecord getFeatureRecord(int i) { return _featureRecords[i]; } - + public Feature getFeature(int i) { return _features[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java index eb610814b..1da74f4d5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java @@ -72,7 +72,7 @@ public class FeatureRecord { public int getTag() { return _tag; } - + public int getOffset() { return _offset; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java index 9a6000156..b662265d9 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -33,7 +33,7 @@ public class FpgmTable extends Program implements Table { public String toString() { return Disassembler.disassemble(getInstructions(), 0); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -43,5 +43,5 @@ public class FpgmTable extends Program implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java index 2748406df..cf4afa88e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -20,10 +20,10 @@ public class GaspRange { public static final int GASP_GRIDFIT = 1; public static final int GASP_DOGRAY = 2; - + private int rangeMaxPPEM; private int rangeGaspBehavior; - + /** Creates new GaspRange */ protected GaspRange(DataInput di) throws IOException { rangeMaxPPEM = di.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java index a83db5bff..45498eda1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -22,7 +22,7 @@ public class GaspTable implements Table { private int version; private int numRanges; private GaspRange[] gaspRange; - + /** Creates new GaspTable */ protected GaspTable(DirectoryEntry de, DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); @@ -49,7 +49,7 @@ public class GaspTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -59,5 +59,5 @@ public class GaspTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java index 4cf254198..50f62ed62 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java @@ -73,7 +73,7 @@ public class GlyfCompositeDescript extends GlyfDescript { int glyphIndex, DataInput di) throws IOException { super(parentTable, glyphIndex, (short) -1, di); - + // Get all of the composite components GlyfCompositeComp comp; int firstIndex = 0; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java index a9342a434..a7e2e7b69 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java @@ -111,7 +111,7 @@ public abstract class GlyfDescript extends Program implements GlyphDescription { public short getYMinimum() { return _yMin; } - + public String toString() { return new StringBuilder() .append(" numberOfContours: ").append(_numberOfContours) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java index c11d2d8ff..f67162cff 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java @@ -73,7 +73,7 @@ public class GlyfSimpleDescript extends GlyfDescript { short numberOfContours, DataInput di) throws IOException { super(parentTable, glyphIndex, numberOfContours, di); - + // Simple glyph description _endPtsOfContours = new int[numberOfContours]; for (int i = 0; i < numberOfContours; i++) { @@ -184,7 +184,7 @@ public class GlyfSimpleDescript extends GlyfDescript { System.out.println("error: array index out of bounds"); } } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java index 22fdd8886..34a8218d9 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java @@ -71,12 +71,12 @@ public class GlyfTable implements Table { LocaTable loca) throws IOException { _de = (DirectoryEntry) de.clone(); _descript = new GlyfDescript[maxp.getNumGlyphs()]; - + // Buffer the whole table so we can randomly access it byte[] buf = new byte[de.getLength()]; di.readFully(buf); ByteArrayInputStream bais = new ByteArrayInputStream(buf); - + // Process all the simple glyphs for (int i = 0; i < maxp.getNumGlyphs(); i++) { int len = loca.getOffset(i + 1) - loca.getOffset(i); @@ -119,7 +119,7 @@ public class GlyfTable implements Table { public int getType() { return glyf; } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java index 106e17917..025778dfc 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java @@ -56,29 +56,29 @@ package jogamp.graph.font.typecast.ot.table; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public interface GlyphDescription { - + public int getGlyphIndex(); - + public int getEndPtOfContours(int i); - + public byte getFlags(int i); - + public short getXCoordinate(int i); - + public short getYCoordinate(int i); - + public short getXMaximum(); - + public short getXMinimum(); - + public short getYMaximum(); - + public short getYMinimum(); - + public boolean isComposite(); - + public int getPointCount(); - + public int getContourCount(); // public int getComponentIndex(int c); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java index 91a62362a..9a367412d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java @@ -48,7 +48,7 @@ public class GposTable implements Table { public int getType() { return GPOS; } - + public String toString() { return "GPOS"; } @@ -62,5 +62,5 @@ public class GposTable implements Table { public DirectoryEntry getDirectoryEntry() { return _de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java index c002de374..0351c903d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java @@ -66,10 +66,10 @@ public class GsubTable implements Table, LookupSubtableFactory { private ScriptList _scriptList; private FeatureList _featureList; private LookupList _lookupList; - + protected GsubTable(DirectoryEntry de, DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); - + // Load into a temporary buffer, and create another input stream byte[] buf = new byte[de.getLength()]; di.readFully(buf); @@ -86,17 +86,17 @@ public class GsubTable implements Table, LookupSubtableFactory { // Feature List _featureList = new FeatureList(dis, featureListOffset); - + // Lookup List _lookupList = new LookupList(dis, lookupListOffset, this); } /** - * 1 - Single - Replace one glyph with one glyph - * 2 - Multiple - Replace one glyph with more than one glyph - * 3 - Alternate - Replace one glyph with one of many glyphs - * 4 - Ligature - Replace multiple glyphs with one glyph - * 5 - Context - Replace one or more glyphs in context + * 1 - Single - Replace one glyph with one glyph + * 2 - Multiple - Replace one glyph with more than one glyph + * 3 - Alternate - Replace one glyph with one of many glyphs + * 4 - Ligature - Replace multiple glyphs with one glyph + * 5 - Context - Replace one or more glyphs in context * 6 - Chaining - Context Replace one or more glyphs in chained context */ public LookupSubtable read( @@ -167,7 +167,7 @@ public class GsubTable implements Table, LookupSubtableFactory { } return "Unknown"; } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -177,5 +177,5 @@ public class GsubTable implements Table, LookupSubtableFactory { public DirectoryEntry getDirectoryEntry() { return _de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java index 5b1fa2020..42f9bf0d0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java @@ -30,9 +30,9 @@ import java.io.IOException; * @version $Id: HdmxTable.java,v 1.2 2007-07-26 11:12:30 davidsch Exp $ */ public class HdmxTable implements Table { - + public class DeviceRecord { - + private short _pixelSize; private short _maxWidth; private short[] _widths; @@ -49,11 +49,11 @@ public class HdmxTable implements Table { public short getPixelSize() { return _pixelSize; } - + public short getMaxWidth() { return _maxWidth; } - + public short[] getWidths() { return _widths; } @@ -61,9 +61,9 @@ public class HdmxTable implements Table { public short getWidth(int glyphidx) { return _widths[glyphidx]; } - + } - + private DirectoryEntry _de; private int _version; private short _numRecords; @@ -78,7 +78,7 @@ public class HdmxTable implements Table { _numRecords = di.readShort(); _sizeDeviceRecords = di.readInt(); _records = new DeviceRecord[_numRecords]; - + // Read the device records for (int i = 0; i < _numRecords; ++i) { _records[i] = new DeviceRecord(maxp.getNumGlyphs(), di); @@ -88,15 +88,15 @@ public class HdmxTable implements Table { public int getNumberOfRecords() { return _numRecords; } - + public DeviceRecord getRecord(int i) { return _records[i]; } - + public int getType() { return hdmx; } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append("'hdmx' Table - Horizontal Device Metrics\n----------------------------------------\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java index 9d7fe4251..cf7c58449 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java @@ -192,7 +192,7 @@ public class HeadTable implements Table { .append("\n glyphDataFormat: ").append(_glyphDataFormat) .toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -202,5 +202,5 @@ public class HeadTable implements Table { public DirectoryEntry getDirectoryEntry() { return _de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java index 20a21e4d9..0278929f1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -122,7 +122,7 @@ public class HheaTable implements Table { .append("\n numOf_LongHorMetrics: ").append(numberOfHMetrics) .toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -132,5 +132,5 @@ public class HheaTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java index 9fd66e728..eed8c1841 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java @@ -38,7 +38,7 @@ public abstract class ID { public static final short encodingUnicode11Semantics = 1; public static final short encodingISO10646Semantics = 2; public static final short encodingUnicode20Semantics = 3; - + // Microsoft Encoding IDs // public static final short encodingUndefined = 0; // public static final short encodingUGL = 1; @@ -203,7 +203,7 @@ public abstract class ID { public static String getEncodingName(short platformId, short encodingId) { if (platformId == platformUnicode) { - + // Unicode specific encodings switch (encodingId) { case encodingUnicode10Semantics: return "Unicode 1.0 semantics"; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java index 7a4cccba2..04fd646a7 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -21,7 +21,7 @@ public abstract class KernSubtable { /** Creates new KernSubtable */ protected KernSubtable() { } - + public abstract int getKerningPairCount(); public abstract KerningPair getKerningPair(int i); @@ -32,7 +32,7 @@ public abstract class KernSubtable { int length = di.readUnsignedShort(); int coverage = di.readUnsignedShort(); int format = coverage >> 8; - + switch (format) { case 0: table = new KernSubtableFormat0(di); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java index b55bef6d5..89e6f9f11 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -17,7 +17,7 @@ import java.io.IOException; * @version $Id: KernSubtableFormat0.java,v 1.1.1.1 2004-12-05 23:14:48 davidsch Exp $ */ public class KernSubtableFormat0 extends KernSubtable { - + private int nPairs; private int searchRange; private int entrySelector; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java index 60d584ca6..6f5e1f5e8 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java index 70aee70d2..1d526865a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -17,7 +17,7 @@ import java.io.IOException; * @version $Id: KernTable.java,v 1.1.1.1 2004-12-05 23:14:48 davidsch Exp $ */ public class KernTable implements Table { - + private DirectoryEntry de; private int version; private int nTables; @@ -37,7 +37,7 @@ public class KernTable implements Table { public int getSubtableCount() { return nTables; } - + public KernSubtable getSubtable(int i) { return tables[i]; } @@ -58,5 +58,5 @@ public class KernTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java index ce7cebc97..52f82cc85 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java index 6759208f5..1ab112a78 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java @@ -64,7 +64,7 @@ public class LangSys { private int _reqFeatureIndex; private int _featureCount; private int[] _featureIndex; - + /** Creates new LangSys */ protected LangSys(DataInput di) throws IOException { _lookupOrder = di.readUnsignedShort(); @@ -75,19 +75,19 @@ public class LangSys { _featureIndex[i] = di.readUnsignedShort(); } } - + public int getLookupOrder() { return _lookupOrder; } - + public int getReqFeatureIndex() { return _reqFeatureIndex; } - + public int getFeatureCount() { return _featureCount; } - + public int getFeatureIndex(int i) { return _featureIndex[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java index 9511f66ba..f3befe3b6 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java @@ -62,7 +62,7 @@ public class LangSysRecord { private int _tag; private int _offset; - + /** Creates new LangSysRecord */ public LangSysRecord(DataInput di) throws IOException { _tag = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java index d3e2ad5cd..de862a983 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java @@ -73,11 +73,11 @@ public class Ligature { _components[i] = di.readUnsignedShort(); } } - + public int getGlyphCount() { return _compCount; } - + public int getGlyphId(int i) { return (i == 0) ? _ligGlyph : _components[i-1]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java index a0f42662c..cad5e106a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java @@ -91,5 +91,5 @@ public class LigatureSubstFormat1 extends LigatureSubst { public String getTypeAsString() { return "LigatureSubstFormat1"; - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java index 5eb7c5856..ce0862eea 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -64,7 +64,7 @@ public class LocaTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java index 2899c24d9..6496c3791 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java @@ -79,7 +79,7 @@ public class Lookup { // Ensure we're in the right place dis.reset(); dis.skipBytes(offset); - + // Start reading _type = dis.readUnsignedShort(); _flag = dis.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java index a3b71b639..e70a932e4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java @@ -67,11 +67,11 @@ public class LookupList { /** Creates new LookupList */ public LookupList(DataInputStream dis, int offset, LookupSubtableFactory factory) throws IOException { - + // Ensure we're in the right place dis.reset(); dis.skipBytes(offset); - + // Start reading _lookupCount = dis.readUnsignedShort(); _lookupOffsets = new int[_lookupCount]; @@ -87,11 +87,11 @@ public class LookupList { public int getLookupCount() { return _lookupCount; } - + public int getLookupOffset(int i) { return _lookupOffsets[i]; } - + public Lookup getLookup(int i) { return _lookups[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java index cb4d28d2c..ca67df7fb 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java @@ -47,13 +47,13 @@ Apache Software Foundation, please see <http://www.apache.org/>. */ - + package jogamp.graph.font.typecast.ot.table; import java.io.DataInputStream; import java.io.IOException; -/** +/** * * @author <a href="mailto:[email protected]">David Schweinsberg</a> * @version $Id: LookupSubtableFactory.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $ diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java index ace3d38b5..9b0c8e6b4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -22,7 +22,7 @@ public class LtshTable implements Table { private int version; private int numGlyphs; private int[] yPels; - + /** Creates new LtshTable */ protected LtshTable(DirectoryEntry de, DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); @@ -41,7 +41,7 @@ public class LtshTable implements Table { public int getType() { return LTSH; } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append("'LTSH' Table - Linear Threshold Table\n-------------------------------------") @@ -54,7 +54,7 @@ public class LtshTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -64,5 +64,5 @@ public class LtshTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java index 0e8ec44c7..5ab6b51ca 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -39,7 +39,7 @@ public class MaxpTable implements Table { protected MaxpTable(DirectoryEntry de, DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); versionNumber = di.readInt(); - + // CFF fonts use version 0.5, TrueType fonts use version 1.0 if (versionNumber == 0x00005000) { numGlyphs = di.readUnsignedShort(); @@ -149,7 +149,7 @@ public class MaxpTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -159,5 +159,5 @@ public class MaxpTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java index 268d6cfca..9f9822986 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java @@ -75,19 +75,19 @@ public class NameRecord { _stringLength = di.readShort(); _stringOffset = di.readShort(); } - + public short getEncodingId() { return _encodingId; } - + public short getLanguageId() { return _languageId; } - + public short getNameId() { return _nameId; } - + public short getPlatformId() { return _platformId; } @@ -101,7 +101,7 @@ public class NameRecord { StringBuilder sb = new StringBuilder(); di.skipBytes(_stringOffset); if (_platformId == ID.platformUnicode) { - + // Unicode (big-endian) for (int i = 0; i < _stringLength/2; i++) { sb.append(di.readChar()); @@ -113,13 +113,13 @@ public class NameRecord { sb.append((char) di.readByte()); } } else if (_platformId == ID.platformISO) { - + // ISO encoding, ASCII for (int i = 0; i < _stringLength; i++) { sb.append((char) di.readByte()); } } else if (_platformId == ID.platformMicrosoft) { - + // Microsoft encoding, Unicode char c; for (int i = 0; i < _stringLength/2; i++) { @@ -132,7 +132,7 @@ public class NameRecord { public String toString() { StringBuilder sb = new StringBuilder(); - + sb.append(" Platform ID: ").append(_platformId) .append("\n Specific ID: ").append(_encodingId) .append("\n Language ID: ").append(_languageId) @@ -140,7 +140,7 @@ public class NameRecord { .append("\n Length: ").append(_stringLength) .append("\n Offset: ").append(_stringOffset) .append("\n\n").append(_record); - + return sb.toString(); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java index 6daf2ad60..5b7a17d3b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java @@ -68,25 +68,25 @@ public class NameTable implements Table { private short _numberOfNameRecords; private short _stringStorageOffset; private NameRecord[] _records; - + protected NameTable(DirectoryEntry de, DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); _formatSelector = di.readShort(); _numberOfNameRecords = di.readShort(); _stringStorageOffset = di.readShort(); _records = new NameRecord[_numberOfNameRecords]; - + // Load the records, which contain the encoding information and string // offsets for (int i = 0; i < _numberOfNameRecords; i++) { _records[i] = new NameRecord(di); } - + // Load the string data into a buffer so the records can copy out the // bits they are interested in byte[] buffer = new byte[_de.getLength() - _stringStorageOffset]; di.readFully(buffer); - + // Now let the records get their hands on them for (int i = 0; i < _numberOfNameRecords; i++) { _records[i].loadString( @@ -98,7 +98,7 @@ public class NameTable implements Table { return _numberOfNameRecords; } - + public NameRecord getRecord(int i) { if(_numberOfNameRecords > i) { return _records[i]; @@ -133,7 +133,7 @@ public class NameTable implements Table { public int getType() { return name; } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -143,5 +143,5 @@ public class NameTable implements Table { public DirectoryEntry getDirectoryEntry() { return _de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java index f4fa76e81..9dfbceb99 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java @@ -134,7 +134,7 @@ public class Os2Table implements Table { _usWinDescent = di.readUnsignedShort(); _ulCodePageRange1 = di.readInt(); _ulCodePageRange2 = di.readInt(); - + // OpenType 1.3 if (_version == 2) { _sxHeight = di.readShort(); @@ -276,19 +276,19 @@ public class Os2Table implements Table { public short getXHeight() { return _sxHeight; } - + public short getCapHeight() { return _sCapHeight; } - + public int getDefaultChar() { return _usDefaultChar; } - + public int getBreakChar() { return _usBreakChar; } - + public int getMaxContext() { return _usMaxContext; } @@ -335,7 +335,7 @@ public class Os2Table implements Table { .append("\n CodePage Range 2( Bits 32- 63 ): ").append(Integer.toHexString(_ulCodePageRange2).toUpperCase()) .toString(); } - + private String getVendorIDAsString() { return new StringBuilder() .append((char)((_achVendorID>>24)&0xff)) @@ -344,7 +344,7 @@ public class Os2Table implements Table { .append((char)((_achVendorID)&0xff)) .toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java index 6127140d1..1f6c5a1dd 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -42,11 +42,11 @@ public class Panose { public byte getFamilyType() { return bFamilyType; } - + public byte getSerifStyle() { return bSerifStyle; } - + public byte getWeight() { return bWeight; } @@ -54,31 +54,31 @@ public class Panose { public byte getProportion() { return bProportion; } - + public byte getContrast() { return bContrast; } - + public byte getStrokeVariation() { return bStrokeVariation; } - + public byte getArmStyle() { return bArmStyle; } - + public byte getLetterForm() { return bLetterform; } - + public byte getMidline() { return bMidline; } - + public byte getXHeight() { return bXHeight; } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append(String.valueOf(bFamilyType)).append(" ") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java index f9dcf2ce7..6ed9b2b9c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -68,7 +68,7 @@ public class PcltTable implements Table { public int getType() { return PCLT; } - + public String toString() { return new StringBuilder() .append("'PCLT' Table - Printer Command Language Table\n---------------------------------------------") @@ -91,7 +91,7 @@ public class PcltTable implements Table { .append("\n reserved: ").append(reserved) .toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -101,5 +101,5 @@ public class PcltTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java index c913b4c71..46f1ac088 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -294,7 +294,7 @@ public class PostTable implements Table { private int maxMemType42; private int minMemType1; private int maxMemType1; - + // v2 private int numGlyphs; private int[] glyphNameIndex; @@ -312,7 +312,7 @@ public class PostTable implements Table { maxMemType42 = di.readInt(); minMemType1 = di.readInt(); maxMemType1 = di.readInt(); - + if (version == 0x00020000) { numGlyphs = di.readUnsignedShort(); glyphNameIndex = new int[numGlyphs]; @@ -366,7 +366,7 @@ public class PostTable implements Table { return false; } } - + /** Get the table type, as a table directory value. * @return The table type */ @@ -409,7 +409,7 @@ public class PostTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -419,5 +419,5 @@ public class PostTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java index aac10c539..2046d7fe4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -33,7 +33,7 @@ public class PrepTable extends Program implements Table { public String toString() { return Disassembler.disassemble(getInstructions(), 0); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -43,5 +43,5 @@ public class PrepTable extends Program implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java index 28c148c2b..e3beabef8 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java index 72d703bb4..40ddf4215 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java @@ -75,7 +75,7 @@ public class RangeRecord { public boolean isInRange(int glyphId) { return (_start <= glyphId && glyphId <= _end); } - + public int getCoverageIndex(int glyphId) { if (isInRange(glyphId)) { return _startCoverageIndex + glyphId - _start; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java index eb534b5dd..04781a8f9 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java @@ -65,14 +65,14 @@ public class Script { private LangSysRecord[] _langSysRecords; private LangSys _defaultLangSys; private LangSys[] _langSys; - + /** Creates new ScriptTable */ protected Script(DataInputStream dis, int offset) throws IOException { // Ensure we're in the right place dis.reset(); dis.skipBytes(offset); - + // Start reading _defaultLangSysOffset = dis.readUnsignedShort(); _langSysCount = dis.readUnsignedShort(); @@ -102,7 +102,7 @@ public class Script { public int getLangSysCount() { return _langSysCount; } - + public LangSysRecord getLangSysRecord(int i) { return _langSysRecords[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java index 4af62b0ee..18589b712 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java @@ -63,14 +63,14 @@ public class ScriptList { private int _scriptCount = 0; private ScriptRecord[] _scriptRecords; private Script[] _scripts; - + /** Creates new ScriptList */ protected ScriptList(DataInputStream dis, int offset) throws IOException { - + // Ensure we're in the right place dis.reset(); dis.skipBytes(offset); - + // Start reading _scriptCount = dis.readUnsignedShort(); _scriptRecords = new ScriptRecord[_scriptCount]; @@ -86,15 +86,15 @@ public class ScriptList { public int getScriptCount() { return _scriptCount; } - + public ScriptRecord getScriptRecord(int i) { return _scriptRecords[i]; } - + public Script getScript(int i) { return _scripts[i]; } - + public Script findScript(String tag) { if (tag.length() != 4) { return null; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java index 5da0608dd..183ca2ffd 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java @@ -62,7 +62,7 @@ public class ScriptRecord { private int _tag; private int _offset; - + /** Creates new ScriptRecord */ protected ScriptRecord(DataInput di) throws IOException { _tag = di.readInt(); @@ -72,7 +72,7 @@ public class ScriptRecord { public int getTag() { return _tag; } - + public int getOffset() { return _offset; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java index 5a5de119f..15f0cd04f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -22,7 +22,7 @@ public class SignatureBlock { private int reserved2; private int signatureLen; private byte[] signature; - + /** Creates new SignatureBlock */ protected SignatureBlock(DataInput di) throws IOException { reserved1 = di.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java index 8c56a740f..e31281f2e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java @@ -63,7 +63,7 @@ public abstract class SingleSubst extends LookupSubtable { public abstract int getFormat(); public abstract int substitute(int glyphId); - + public static SingleSubst read(DataInputStream dis, int offset) throws IOException { SingleSubst s = null; dis.reset(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java index 99b85f35c..a8df78504 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java @@ -84,7 +84,7 @@ public class SingleSubstFormat1 extends SingleSubst { } return glyphId; } - + public String getTypeAsString() { return "SingleSubstFormat1"; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java index cd3b6d147..2e47b2924 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java @@ -92,6 +92,6 @@ public class SingleSubstFormat2 extends SingleSubst { public String getTypeAsString() { return "SingleSubstFormat2"; - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java index b801517f8..f7c7d99b5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -17,7 +17,7 @@ import java.io.IOException; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public class TTCHeader { - + public static final int ttcf = 0x74746366; private int ttcTag; @@ -47,7 +47,7 @@ public class TTCHeader { public int getDirectoryCount() { return directoryCount; } - + public int getTableDirectory(int i) { return tableDirectory[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java index 624f47bef..30fd2f457 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -51,7 +51,7 @@ public interface Table { public static final int vmtx = 0x766d7478; // Vertical Metrics public static final String notAvailable = "n/a"; - + /** * Get the table type, as a table directory value. * @return The table type @@ -65,5 +65,5 @@ public interface Table { * @return A directory entry */ public DirectoryEntry getDirectoryEntry(); - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java index bacc26d30..8c5678088 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java @@ -112,7 +112,7 @@ public class TableDirectory { public int getVersion() { return _version; } - + public String toString() { StringBuilder sb = new StringBuilder() .append("Offset Table\n------ -----") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java index 7749ea856..65aa84bff 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java @@ -26,7 +26,7 @@ package jogamp.graph.font.typecast.ot.table; * @version $Id: TableException.java,v 1.1.1.1 2004-12-05 23:15:00 davidsch Exp $ */ public class TableException extends java.lang.Exception { - + private static final long serialVersionUID = 1L; /** @@ -34,8 +34,8 @@ public class TableException extends java.lang.Exception { */ public TableException() { } - - + + /** * Constructs an instance of <code>TableException</code> with the specified detail message. * @param msg the detail message. diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java index 998ce08e3..956d1aecd 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java @@ -47,7 +47,7 @@ Apache Software Foundation, please see <http://www.apache.org/>. */ - + package jogamp.graph.font.typecast.ot.table; import java.io.DataInputStream; @@ -56,7 +56,7 @@ import java.io.IOException; import jogamp.graph.font.typecast.ot.OTFont; import jogamp.graph.font.typecast.ot.OTFontCollection; -/** +/** * * @version $Id: TableFactory.java,v 1.7 2007-02-05 12:39:51 davidsch Exp $ * @author <a href="mailto:[email protected]">David Schweinsberg</a> @@ -69,7 +69,7 @@ public class TableFactory { DirectoryEntry de, DataInputStream dis) throws IOException { Table t = null; - + // First, if we have a font collection, look for the table there if (fc != null) { t = fc.getTable(de); @@ -77,7 +77,7 @@ public class TableFactory { return t; } } - + // Create the table switch (de.getTag()) { case Table.BASE: @@ -175,7 +175,7 @@ public class TableFactory { t = new VmtxTable(de, dis, font.getVheaTable(), font.getMaxpTable()); break; } - + // If we have a font collection, add this table to it if ((fc != null) && (t != null)) { fc.addTable(t); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java index 80579f5cd..28f9aa6e3 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java @@ -31,12 +31,12 @@ import java.io.IOException; public class VdmxTable implements Table { private class Ratio { - + private byte _bCharSet; private byte _xRatio; private byte _yStartRatio; private byte _yEndRatio; - + protected Ratio(DataInput di) throws IOException { _bCharSet = di.readByte(); _xRatio = di.readByte(); @@ -47,26 +47,26 @@ public class VdmxTable implements Table { public byte getBCharSet() { return _bCharSet; } - + public byte getXRatio() { return _xRatio; } - + public byte getYStartRatio() { return _yStartRatio; } - + public byte getYEndRatio() { return _yEndRatio; } } - + private class VTableRecord { - + private int _yPelHeight; private short _yMax; private short _yMin; - + protected VTableRecord(DataInput di) throws IOException { _yPelHeight = di.readUnsignedShort(); _yMax = di.readShort(); @@ -76,23 +76,23 @@ public class VdmxTable implements Table { public int getYPelHeight() { return _yPelHeight; } - + public short getYMax() { return _yMax; } - + public short getYMin() { return _yMin; } } - + private class Group { - + private int _recs; private int _startsz; private int _endsz; private VTableRecord[] _entry; - + protected Group(DataInput di) throws IOException { _recs = di.readUnsignedShort(); _startsz = di.readUnsignedByte(); @@ -106,20 +106,20 @@ public class VdmxTable implements Table { public int getRecs() { return _recs; } - + public int getStartSZ() { return _startsz; } - + public int getEndSZ() { return _endsz; } - + public VTableRecord[] getEntry() { return _entry; } } - + private DirectoryEntry _de; private int _version; private int _numRecs; @@ -127,7 +127,7 @@ public class VdmxTable implements Table { private Ratio[] _ratRange; private int _offset[]; private Group[] _groups; - + /** Creates a new instance of VdmxTable */ protected VdmxTable(DirectoryEntry de, DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); @@ -147,11 +147,11 @@ public class VdmxTable implements Table { _groups[i] = new Group(di); } } - + public int getType() { return VDMX; } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append("'VDMX' Table - Precomputed Vertical Device Metrics\n") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java index 19c91765b..f42da119b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java @@ -135,7 +135,7 @@ public class VheaTable implements Table { .append("\n numOf_LongVerMetrics: ").append(_numberOfLongVerMetrics) .toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java index 887f8c34f..181ec7e10 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java @@ -34,23 +34,23 @@ import jogamp.graph.font.typecast.ot.table.CharstringType2; * @version $Id: T2Interpreter.java,v 1.2 2007-07-26 11:10:18 davidsch Exp $ */ public class T2Interpreter { - + private static final int ARGUMENT_STACK_LIMIT = 48; private static final int SUBR_STACK_LIMIT = 10; private static final int TRANSIENT_ARRAY_ELEMENT_COUNT = 32; - + private Number[] _argStack = new Number[ARGUMENT_STACK_LIMIT]; private int _argStackIndex = 0; private int[] _subrStack = new int[SUBR_STACK_LIMIT]; private int _subrStackIndex = 0; private Number[] _transientArray = new Number[TRANSIENT_ARRAY_ELEMENT_COUNT]; - + private ArrayList<Point> _points; /** Creates a new instance of T2Interpreter */ public T2Interpreter() { } - + /** * Moves the current point to a position at the relative coordinates * (dx1, dy1). @@ -72,7 +72,7 @@ public class T2Interpreter { Point lastPoint = getLastPoint(); moveTo(lastPoint.x + dx1, lastPoint.y); } - + /** * Moves the current point dy1 units in the vertical direction. */ @@ -82,7 +82,7 @@ public class T2Interpreter { Point lastPoint = getLastPoint(); moveTo(lastPoint.x, lastPoint.y + dy1); } - + /** * Appends a line from the current point to a position at the * relative coordinates dxa, dya. Additional rlineto operations are @@ -103,7 +103,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends a horizontal line of length dx1 to the current point. * With an odd number of arguments, subsequent argument pairs @@ -130,7 +130,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends a vertical line of length dy1 to the current point. With * an odd number of arguments, subsequent argument pairs are @@ -157,7 +157,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends a Bezier curve, defined by dxa...dyc, to the current * point. For each subsequent set of six arguments, an additional @@ -194,7 +194,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends one or more Bezier curves, as described by the * dxa...dxc set of arguments, to the current point. For each curve, @@ -230,7 +230,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends one or more Bezier curves to the current point. The * tangent for the first Bezier must be horizontal, and the second @@ -327,13 +327,13 @@ public class T2Interpreter { int yf = ye + dyf[i]; curveTo(xa, ya, xb, yb, xc, yc); curveTo(xd, yd, xe, ye, xf, yf); - + // What on earth do we do with dx1, dx2, dy2 and dy3? } } clearArg(); } - + /** * Is equivalent to one rrcurveto for each set of six arguments * dxa...dyc, followed by exactly one rlineto using the dxd, dyd @@ -373,7 +373,7 @@ public class T2Interpreter { lineTo(xc + dxd, yc + dyd); clearArg(); } - + /** * Is equivalent to one rlineto for each pair of arguments beyond * the six arguments dxb...dyd needed for the one rrcurveto @@ -411,7 +411,7 @@ public class T2Interpreter { curveTo(xb, yb, xc, yc, xd, yd); clearArg(); } - + /** * Appends one or more Bezier curves to the current point, where * the first tangent is vertical and the second tangent is horizontal. @@ -465,7 +465,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends one or more curves to the current point. If the argument * count is a multiple of four, the curve starts and ends vertical. If @@ -473,10 +473,10 @@ public class T2Interpreter { * vertical tangent. */ private void _vvcurveto() { - + clearArg(); } - + /** * Causes two Bezier curves, as described by the arguments (as * shown in Figure 2 below), to be rendered as a straight line when @@ -485,10 +485,10 @@ public class T2Interpreter { * pixels. */ private void _flex() { - + clearArg(); } - + /** * Causes the two curves described by the arguments dx1...dx6 to * be rendered as a straight line when the flex depth is less than @@ -496,10 +496,10 @@ public class T2Interpreter { * flex depth is greater than or equal to 0.5 device pixels. */ private void _hflex() { - + clearArg(); } - + /** * Causes the two curves described by the arguments to be * rendered as a straight line when the flex depth is less than 0.5 @@ -507,10 +507,10 @@ public class T2Interpreter { * than or equal to 0.5 device pixels. */ private void _hflex1() { - + clearArg(); } - + /** * Causes the two curves described by the arguments to be * rendered as a straight line when the flex depth is less than 0.5 @@ -518,10 +518,10 @@ public class T2Interpreter { * than or equal to 0.5 device pixels. */ private void _flex1() { - + clearArg(); } - + /** * Finishes a charstring outline definition, and must be the * last operator in a character's outline. @@ -530,37 +530,37 @@ public class T2Interpreter { endContour(); clearArg(); } - + private void _hstem() { - + clearArg(); } - + private void _vstem() { - + clearArg(); } - + private void _hstemhm() { - + clearArg(); } - + private void _vstemhm() { - + clearArg(); } - + private void _hintmask() { - + clearArg(); } - + private void _cntrmask() { - + clearArg(); } - + /** * Returns the absolute value of num. */ @@ -568,7 +568,7 @@ public class T2Interpreter { double num = popArg().doubleValue(); pushArg(Math.abs(num)); } - + /** * Returns the sum of the two numbers num1 and num2. */ @@ -577,7 +577,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg(num1 + num2); } - + /** * Returns the result of subtracting num2 from num1. */ @@ -586,7 +586,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg(num1 - num2); } - + /** * Returns the quotient of num1 divided by num2. The result is * undefined if overflow occurs and is zero for underflow. @@ -596,7 +596,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg(num1 / num2); } - + /** * Returns the negative of num. */ @@ -604,7 +604,7 @@ public class T2Interpreter { double num = popArg().doubleValue(); pushArg(-num); } - + /** * Returns a pseudo random number num2 in the range (0,1], that * is, greater than zero and less than or equal to one. @@ -612,7 +612,7 @@ public class T2Interpreter { private void _random() { pushArg(1.0 - Math.random()); } - + /** * Returns the product of num1 and num2. If overflow occurs, the * result is undefined, and zero is returned for underflow. @@ -622,7 +622,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg(num1 * num2); } - + /** * Returns the square root of num. If num is negative, the result is * undefined. @@ -631,14 +631,14 @@ public class T2Interpreter { double num = popArg().doubleValue(); pushArg(Math.sqrt(num)); } - + /** * Removes the top element num from the Type 2 argument stack. */ private void _drop() { popArg(); } - + /** * Exchanges the top two elements on the argument stack. */ @@ -648,7 +648,7 @@ public class T2Interpreter { pushArg(num2); pushArg(num1); } - + /** * Retrieves the element i from the top of the argument stack and * pushes a copy of that element onto that stack. If i is negative, @@ -666,7 +666,7 @@ public class T2Interpreter { } pushArg(nums[i]); } - + /** * Performs a circular shift of the elements num(Nx1) ... num0 on * the argument stack by the amount J. Positive J indicates upward @@ -685,7 +685,7 @@ public class T2Interpreter { pushArg(nums[(n + i + j) % n]); } } - + /** * Duplicates the top element on the argument stack. */ @@ -694,7 +694,7 @@ public class T2Interpreter { pushArg(any); pushArg(any); } - + /** * Stores val into the transient array at the location given by i. */ @@ -703,7 +703,7 @@ public class T2Interpreter { Number val = popArg(); _transientArray[i] = val; } - + /** * Retrieves the value stored in the transient array at the location * given by i and pushes the value onto the argument stack. If get @@ -714,7 +714,7 @@ public class T2Interpreter { int i = popArg().intValue(); pushArg(_transientArray[i]); } - + /** * Puts a 1 on the stack if num1 and num2 are both non-zero, and * puts a 0 on the stack if either argument is zero. @@ -724,7 +724,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg((num1!=0.0) && (num2!=0.0) ? 1 : 0); } - + /** * Puts a 1 on the stack if either num1 or num2 are non-zero, and * puts a 0 on the stack if both arguments are zero. @@ -734,7 +734,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg((num1!=0.0) || (num2!=0.0) ? 1 : 0); } - + /** * Returns a 0 if num1 is non-zero; returns a 1 if num1 is zero. */ @@ -742,7 +742,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg((num1!=0.0) ? 0 : 1); } - + /** * Puts a 1 on the stack if num1 equals num2, otherwise a 0 (zero) * is put on the stack. @@ -752,7 +752,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg(num1 == num2 ? 1 : 0); } - + /** * Leaves the value s1 on the stack if v1 ? v2, or leaves s2 on the * stack if v1 > v2. The value of s1 and s2 is usually the biased @@ -765,7 +765,7 @@ public class T2Interpreter { Number s1 = popArg(); pushArg(v1 <= v2 ? s1 : s2); } - + /** * Calls a charstring subroutine with index subr# (actually the subr * number plus the subroutine bias number, as described in section @@ -777,25 +777,25 @@ public class T2Interpreter { * Calling an undefined subr (gsubr) has undefined results. */ private void _callsubr() { - + } - + /** * Operates in the same manner as callsubr except that it calls a * global subroutine. */ private void _callgsubr() { - + } - + /** * Returns from either a local or global charstring subroutine, and * continues execution after the corresponding call(g)subr. */ private void _return() { - + } - + public Point[] execute(CharstringType2 cs) { _points = new ArrayList<Point>(); cs.resetIP(); @@ -975,7 +975,7 @@ public class T2Interpreter { private int getArgCount() { return _argStackIndex; } - + /** * Pop a value off the argument stack */ @@ -989,7 +989,7 @@ public class T2Interpreter { private void pushArg(Number n) { _argStack[_argStackIndex++] = n; } - + /** * Pop a value off the subroutine stack */ @@ -1003,14 +1003,14 @@ public class T2Interpreter { private void pushSubr(int n) { _subrStack[_subrStackIndex++] = n; } - + /** * Clear the argument stack */ private void clearArg() { _argStackIndex = 0; } - + private Point getLastPoint() { int size = _points.size(); if (size > 0) { @@ -1019,22 +1019,22 @@ public class T2Interpreter { return new Point(0, 0, true, false); } } - + private void moveTo(int x, int y) { endContour(); _points.add(new Point(x, y, true, false)); } - + private void lineTo(int x, int y) { _points.add(new Point(x, y, true, false)); } - + private void curveTo(int cx1, int cy1, int cx2, int cy2, int x, int y) { _points.add(new Point(cx1, cy1, false, false)); _points.add(new Point(cx2, cy2, false, false)); _points.add(new Point(x, y, true, false)); } - + private void endContour() { Point lastPoint = getLastPoint(); if (lastPoint != null) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java index a659a7003..2bb5cec0c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java @@ -570,7 +570,7 @@ public class Interpreter { private void _mps() { push(0); } - + private void _msirp(short param) { pop(); pop(); @@ -1190,7 +1190,7 @@ public class Interpreter { while (ip < ((ip & 0xffff0000) | parser.getISLength(ip >> 16))) { short opcode = parser.getOpcode(ip); if (inFuncDef) { - + // We're within a function definition, so don't execute the code if (opcode == Mnemonic.ENDF) { inFuncDef = false; diff --git a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java index 0fd174cda..32e2b6a39 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java @@ -33,7 +33,7 @@ public class AffineTransform implements Cloneable, Serializable { private static final long serialVersionUID = 1330973210523860834L; static final String determinantIsZero = "Determinant is zero"; - + public static final int TYPE_IDENTITY = 0; public static final int TYPE_TRANSLATION = 1; public static final int TYPE_UNIFORM_SCALE = 2; @@ -49,14 +49,14 @@ public class AffineTransform implements Cloneable, Serializable { * The <code>TYPE_UNKNOWN</code> is an initial type value */ static final int TYPE_UNKNOWN = -1; - + /** - * The min value equivalent to zero. If absolute value less then ZERO it considered as zero. + * The min value equivalent to zero. If absolute value less then ZERO it considered as zero. */ static final float ZERO = (float) 1E-10; - + private final Vertex.Factory<? extends Vertex> pointFactory; - + /** * The values of transformation matrix */ @@ -68,7 +68,7 @@ public class AffineTransform implements Cloneable, Serializable { float m12; /** - * The transformation <code>type</code> + * The transformation <code>type</code> */ transient int type; @@ -123,20 +123,20 @@ public class AffineTransform implements Cloneable, Serializable { /* * Method returns type of affine transformation. - * + * * Transform matrix is * m00 m01 m02 * m10 m11 m12 - * - * According analytic geometry new basis vectors are (m00, m01) and (m10, m11), - * translation vector is (m02, m12). Original basis vectors are (1, 0) and (0, 1). - * Type transformations classification: + * + * According analytic geometry new basis vectors are (m00, m01) and (m10, m11), + * translation vector is (m02, m12). Original basis vectors are (1, 0) and (0, 1). + * Type transformations classification: * TYPE_IDENTITY - new basis equals original one and zero translation - * TYPE_TRANSLATION - translation vector isn't zero + * TYPE_TRANSLATION - translation vector isn't zero * TYPE_UNIFORM_SCALE - vectors length of new basis equals - * TYPE_GENERAL_SCALE - vectors length of new basis doesn't equal + * TYPE_GENERAL_SCALE - vectors length of new basis doesn't equal * TYPE_FLIP - new basis vector orientation differ from original one - * TYPE_QUADRANT_ROTATION - new basis is rotated by 90, 180, 270, or 360 degrees + * TYPE_QUADRANT_ROTATION - new basis is rotated by 90, 180, 270, or 360 degrees * TYPE_GENERAL_ROTATION - new basis is rotated by arbitrary angle * TYPE_GENERAL_TRANSFORM - transformation can't be inversed */ @@ -322,7 +322,7 @@ public class AffineTransform implements Cloneable, Serializable { } public static <T extends Vertex> AffineTransform getShearInstance(Vertex.Factory<? extends Vertex> factory, float shx, float shy) { - AffineTransform t = new AffineTransform(factory); + AffineTransform t = new AffineTransform(factory); t.setToShear(shx, shy); return t; } @@ -359,13 +359,13 @@ public class AffineTransform implements Cloneable, Serializable { concatenate(AffineTransform.getRotateInstance(pointFactory, angle, px, py)); } - /** + /** * Multiply matrix of two AffineTransform objects. * The first argument's {@link Vertex.Factory} is being used. - * + * * @param t1 - the AffineTransform object is a multiplicand * @param t2 - the AffineTransform object is a multiplier - * @return an AffineTransform object that is a result of t1 multiplied by matrix t2. + * @return an AffineTransform object that is a result of t1 multiplied by matrix t2. */ AffineTransform multiply(AffineTransform t1, AffineTransform t2) { return new AffineTransform(t1.pointFactory, @@ -415,7 +415,7 @@ public class AffineTransform implements Cloneable, Serializable { public void transform(Vertex[] src, int srcOff, Vertex[] dst, int dstOff, int length) { while (--length >= 0) { - Vertex srcPoint = src[srcOff++]; + Vertex srcPoint = src[srcOff++]; float x = srcPoint.getX(); float y = srcPoint.getY(); Vertex dstPoint = dst[dstOff]; @@ -426,7 +426,7 @@ public class AffineTransform implements Cloneable, Serializable { dst[dstOff++] = dstPoint; } } - + public void transform(float[] src, int srcOff, float[] dst, int dstOff, int length) { int step = 2; if (src == dst && srcOff < dstOff && dstOff < srcOff + length * 2) { @@ -443,7 +443,7 @@ public class AffineTransform implements Cloneable, Serializable { dstOff += step; } } - + public Vertex deltaTransform(Vertex src, Vertex dst) { if (dst == null) { dst = pointFactory.create(); @@ -486,7 +486,7 @@ public class AffineTransform implements Cloneable, Serializable { { float det = getDeterminant(); if (FloatUtil.abs(det) < ZERO) { - throw new NoninvertibleTransformException(determinantIsZero); + throw new NoninvertibleTransformException(determinantIsZero); } while (--length >= 0) { @@ -554,7 +554,7 @@ public class AffineTransform implements Cloneable, Serializable { return false; } - + /** * Write AffineTrasform object to the output steam. * @param stream - the output stream @@ -564,12 +564,12 @@ public class AffineTransform implements Cloneable, Serializable { stream.defaultWriteObject(); } - + /** * Read AffineTransform object from the input stream * @param stream - the input steam * @throws IOException - if there are I/O errors while reading from the input strem - * @throws ClassNotFoundException - if class could not be found + * @throws ClassNotFoundException - if class could not be found */ private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java b/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java index cd4ee2a91..4ee0c250d 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java @@ -29,17 +29,17 @@ public class Crossing { * Allowable tolerance for bounds comparison */ static final float DELTA = (float) 1E-5; - + /** * If roots have distance less then <code>ROOT_DELTA</code> they are double */ static final float ROOT_DELTA = (float) 1E-10; - + /** * Rectangle cross segment */ public static final int CROSSING = 255; - + /** * Unknown crossing result */ @@ -130,8 +130,8 @@ public class Crossing { } /** - * Excludes float roots. Roots are float if they lies enough close with each other. - * @param res - the roots + * Excludes float roots. Roots are float if they lies enough close with each other. + * @param res - the roots * @param rc - the roots count * @return new roots count */ @@ -384,12 +384,12 @@ public class Crossing { // START if (x == x1) { - return x1 < x2 ? 0 : -1; + return x1 < x2 ? 0 : -1; } - + // END if (x == x2) { - return x1 < x2 ? 1 : 0; + return x1 < x2 ? 1 : 0; } // INSIDE-DOWN @@ -493,10 +493,10 @@ public class Crossing { } break; default: - throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType); + throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType); } - - // checks if the point (x,y) is the vertex of shape with PathIterator p + + // checks if the point (x,y) is the vertex of shape with PathIterator p if (x == cx && y == cy) { cross = 0; cy = my; @@ -554,9 +554,9 @@ public class Crossing { } } } - + /** - * Returns are bounds intersect or not intersect rectangle + * Returns are bounds intersect or not intersect rectangle */ static int crossBound(float bound[], int bc, float py1, float py2) { diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java index 945eeceeb..c1ee17a4b 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java @@ -33,12 +33,12 @@ public final class Path2D implements Cloneable { static final String invalidWindingRuleValue = "Invalid winding rule value"; static final String iteratorOutOfBounds = "Iterator out of bounds"; - + /** * The buffers size */ private static final int BUFFER_SIZE = 10; - + /** * The buffers capacity */ @@ -48,24 +48,24 @@ public final class Path2D implements Cloneable { * The point's types buffer */ byte[] types; - + /** * The points buffer */ float[] points; - + /** * The point's type buffer size */ int typeSize; - + /** * The points buffer size */ int pointSize; - + /** - * The path rule + * The path rule */ int rule; @@ -80,7 +80,7 @@ public final class Path2D implements Cloneable { 0}; // CLOSE /* - * GeneralPath path iterator + * GeneralPath path iterator */ class Iterator implements PathIterator { @@ -88,17 +88,17 @@ public final class Path2D implements Cloneable { * The current cursor position in types buffer */ int typeIndex; - + /** * The current cursor position in points buffer */ int pointIndex; - + /** * The source GeneralPath object */ Path2D p; - + /** * The path iterator transformation */ @@ -183,7 +183,7 @@ public final class Path2D implements Cloneable { } /** - * Checks points and types buffer size to add pointCount points. If necessary realloc buffers to enlarge size. + * Checks points and types buffer size to add pointCount points. If necessary realloc buffers to enlarge size. * @param pointCount - the point count to be added in buffer */ void checkBuf(int pointCount, boolean checkMove) { @@ -244,18 +244,18 @@ public final class Path2D implements Cloneable { final public int size() { return typeSize; } - + final public boolean isClosed() { return typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_CLOSE ; } - + public void closePath() { if (!isClosed()) { checkBuf(0, true); types[typeSize++] = PathIterator.SEG_CLOSE; } } - + public String toString() { return "[size "+size()+", closed "+isClosed()+"]"; } @@ -295,7 +295,7 @@ public final class Path2D implements Cloneable { closePath(); break; default: - throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType); + throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType); } path.next(); connect = false; @@ -366,9 +366,9 @@ public final class Path2D implements Cloneable { } /** - * Checks cross count according to path rule to define is it point inside shape or not. + * Checks cross count according to path rule to define is it point inside shape or not. * @param cross - the point cross count - * @return true if point is inside path, or false otherwise + * @return true if point is inside path, or false otherwise */ boolean isInside(int cross) { if (rule == WIND_NON_ZERO) { @@ -396,7 +396,7 @@ public final class Path2D implements Cloneable { } public boolean contains(AABBox r) { - return contains(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight()); + return contains(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight()); } public boolean intersects(AABBox r) { @@ -404,9 +404,9 @@ public final class Path2D implements Cloneable { } public PathIterator iterator() { - return new Iterator(this); + return new Iterator(this); } - + public PathIterator iterator(AffineTransform t) { return new Iterator(this, t); } |