< prev index next >
src/demo/share/jfc/Font2DTest/FontPanel.java
Print this page
*** 390,400 ****
}
setFontParams( name, size, style, transform );
setTransformG2( g2transform ); // ABP
setDrawMethod( method );
setRenderingHints(AAValues.getValue(aa), FMValues.getValue(fm),
! new Integer(contrast));
}
/// Writes the current screen to PNG file
public void doSavePNG( String fileName ) {
fc.writePNG( fileName );
--- 390,400 ----
}
setFontParams( name, size, style, transform );
setTransformG2( g2transform ); // ABP
setDrawMethod( method );
setRenderingHints(AAValues.getValue(aa), FMValues.getValue(fm),
! Integer.valueOf(contrast));
}
/// Writes the current screen to PNG file
public void doSavePNG( String fileName ) {
fc.writePNG( fileName );
*** 432,442 ****
/// Offset from the top left edge of the canvas where the draw will start
private int canvasInset_X = 5, canvasInset_Y = 5;
/// LineBreak'ed TextLayout vector
! private Vector lineBreakTLs = null;
/// Whether the current draw command requested is for printing
private boolean isPrinting = false;
/// Other printing infos
--- 432,442 ----
/// Offset from the top left edge of the canvas where the draw will start
private int canvasInset_X = 5, canvasInset_Y = 5;
/// LineBreak'ed TextLayout vector
! private Vector<TextLayout> lineBreakTLs = null;
/// Whether the current draw command requested is for printing
private boolean isPrinting = false;
/// Other printing infos
*** 798,808 ****
/// If this is text loaded from file, prepares the LineBreak'ed
/// text layout at this point
if ( textToUse == FILE_TEXT ) {
if ( !isPrinting )
f2dt.fireChangeStatus( "LineBreaking Text... Please Wait", false );
! lineBreakTLs = new Vector();
for ( int i = 0; i < fileText.length; i++ ) {
AttributedString as =
new AttributedString( fileText[i], g2.getFont().getAttributes() );
LineBreakMeasurer lbm =
--- 798,808 ----
/// If this is text loaded from file, prepares the LineBreak'ed
/// text layout at this point
if ( textToUse == FILE_TEXT ) {
if ( !isPrinting )
f2dt.fireChangeStatus( "LineBreaking Text... Please Wait", false );
! lineBreakTLs = new Vector<>();
for ( int i = 0; i < fileText.length; i++ ) {
AttributedString as =
new AttributedString( fileText[i], g2.getFont().getAttributes() );
LineBreakMeasurer lbm =
*** 927,937 ****
}
else {
float xPos, yPos = (float) canvasInset_Y;
g2.drawRect( 0, 0, w - 1, h - 1 );
for ( int i = drawStart; i <= drawEnd; i++ ) {
! TextLayout oneLine = (TextLayout) lineBreakTLs.elementAt( i );
xPos =
oneLine.isLeftToRight() ?
canvasInset_X : ( (float) w - oneLine.getAdvance() - canvasInset_X );
float[] fmData = {0, oneLine.getAscent(), 0, oneLine.getDescent(), 0, oneLine.getLeading()};
--- 927,937 ----
}
else {
float xPos, yPos = (float) canvasInset_Y;
g2.drawRect( 0, 0, w - 1, h - 1 );
for ( int i = drawStart; i <= drawEnd; i++ ) {
! TextLayout oneLine = lineBreakTLs.elementAt( i );
xPos =
oneLine.isLeftToRight() ?
canvasInset_X : ( (float) w - oneLine.getAdvance() - canvasInset_X );
float[] fmData = {0, oneLine.getAscent(), 0, oneLine.getDescent(), 0, oneLine.getLeading()};
*** 990,1002 ****
int pageWidth = (int) pf.getImageableWidth();
int pageHeight = (int) pf.getImageableHeight();
/// Back up metrics and other drawing info before printing modifies it
int backupDrawStart = drawStart, backupDrawEnd = drawEnd;
int backupNumCharAcross = numCharAcross, backupNumCharDown = numCharDown;
! Vector backupLineBreakTLs = null;
if ( textToUse == FILE_TEXT )
! backupLineBreakTLs = (Vector) lineBreakTLs.clone();
printPageNumber = pageIndex;
isPrinting = true;
/// Push the actual draw area 60 down to allow info to be printed
g.translate( (int) pf.getImageableX(), (int) pf.getImageableY() + 60 );
--- 990,1002 ----
int pageWidth = (int) pf.getImageableWidth();
int pageHeight = (int) pf.getImageableHeight();
/// Back up metrics and other drawing info before printing modifies it
int backupDrawStart = drawStart, backupDrawEnd = drawEnd;
int backupNumCharAcross = numCharAcross, backupNumCharDown = numCharDown;
! Vector<TextLayout> backupLineBreakTLs = null;
if ( textToUse == FILE_TEXT )
! backupLineBreakTLs = new Vector<>(lineBreakTLs);
printPageNumber = pageIndex;
isPrinting = true;
/// Push the actual draw area 60 down to allow info to be printed
g.translate( (int) pf.getImageableX(), (int) pf.getImageableY() + 60 );
*** 1135,1145 ****
g2.drawRect( 0, 0, zoomAreaWidth, zoomAreaHeight );
modeSpecificDrawChar( g2, currMouseOverChar,
zoomAreaWidth / 2, (int) ( maxAscent * ZOOM ));
g2.dispose();
if ( !nowZooming )
! zoomWindow.show();
/// This is sort of redundant... since there is a paint function
/// inside zoomWindow definition that does the drawImage.
/// (I should be able to call just repaint() here)
/// However, for some reason, that paint function fails to respond
/// from second time and on; So I have to force the paint here...
--- 1135,1145 ----
g2.drawRect( 0, 0, zoomAreaWidth, zoomAreaHeight );
modeSpecificDrawChar( g2, currMouseOverChar,
zoomAreaWidth / 2, (int) ( maxAscent * ZOOM ));
g2.dispose();
if ( !nowZooming )
! zoomWindow.setVisible(true);
/// This is sort of redundant... since there is a paint function
/// inside zoomWindow definition that does the drawImage.
/// (I should be able to call just repaint() here)
/// However, for some reason, that paint function fails to respond
/// from second time and on; So I have to force the paint here...
*** 1174,1184 ****
/// MouseListener interface function
/// Redraws the area that was drawn over by zoomed character
public void mouseReleased( MouseEvent e ) {
if ( textToUse == RANGE_TEXT || textToUse == ALL_GLYPHS ) {
if ( nowZooming )
! zoomWindow.hide();
nowZooming = false;
}
this.setCursor( Cursor.getDefaultCursor() );
}
--- 1174,1184 ----
/// MouseListener interface function
/// Redraws the area that was drawn over by zoomed character
public void mouseReleased( MouseEvent e ) {
if ( textToUse == RANGE_TEXT || textToUse == ALL_GLYPHS ) {
if ( nowZooming )
! zoomWindow.setVisible(false);
nowZooming = false;
}
this.setCursor( Cursor.getDefaultCursor() );
}
*** 1244,1265 ****
public Object getHint() {
return hint;
}
public static Object getValue(int ordinal) {
if (valArray == null) {
! valArray = (FMValues[])EnumSet.allOf(FMValues.class).toArray(new FMValues[0]);
}
for (int i=0;i<valArray.length;i++) {
if (valArray[i].ordinal() == ordinal) {
return valArray[i];
}
}
return valArray[0];
}
private static FMValues[] getArray() {
if (valArray == null) {
! valArray = (FMValues[])EnumSet.allOf(FMValues.class).toArray(new FMValues[0]);
}
return valArray;
}
public static int getHintVal(Object hint) {
--- 1244,1265 ----
public Object getHint() {
return hint;
}
public static Object getValue(int ordinal) {
if (valArray == null) {
! valArray = EnumSet.allOf(FMValues.class).toArray(new FMValues[0]);
}
for (int i=0;i<valArray.length;i++) {
if (valArray[i].ordinal() == ordinal) {
return valArray[i];
}
}
return valArray[0];
}
private static FMValues[] getArray() {
if (valArray == null) {
! valArray = EnumSet.allOf(FMValues.class).toArray(new FMValues[0]);
}
return valArray;
}
public static int getHintVal(Object hint) {
*** 1306,1316 ****
((AAValues)o).ordinal() >= AALCDHRGB.ordinal());
}
public static Object getValue(int ordinal) {
if (valArray == null) {
! valArray = (AAValues[])EnumSet.allOf(AAValues.class).toArray(new AAValues[0]);
}
for (int i=0;i<valArray.length;i++) {
if (valArray[i].ordinal() == ordinal) {
return valArray[i];
}
--- 1306,1316 ----
((AAValues)o).ordinal() >= AALCDHRGB.ordinal());
}
public static Object getValue(int ordinal) {
if (valArray == null) {
! valArray = EnumSet.allOf(AAValues.class).toArray(new AAValues[0]);
}
for (int i=0;i<valArray.length;i++) {
if (valArray[i].ordinal() == ordinal) {
return valArray[i];
}
*** 1319,1329 ****
}
private static AAValues[] getArray() {
if (valArray == null) {
Object [] oa = EnumSet.allOf(AAValues.class).toArray(new AAValues[0]);
! valArray = (AAValues[])(EnumSet.allOf(AAValues.class).toArray(new AAValues[0]));
}
return valArray;
}
public static int getHintVal(Object hint) {
--- 1319,1329 ----
}
private static AAValues[] getArray() {
if (valArray == null) {
Object [] oa = EnumSet.allOf(AAValues.class).toArray(new AAValues[0]);
! valArray = EnumSet.allOf(AAValues.class).toArray(new AAValues[0]);
}
return valArray;
}
public static int getHintVal(Object hint) {
< prev index next >