< prev index next >
src/java.desktop/share/classes/sun/font/FontFamily.java
Print this page
rev 60042 : 8248802: Add log helper methods to FontUtilities.java
*** 1,7 ****
/*
! * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 179,199 ****
if (Math.abs(Font2D.FWIDTH_NORMAL - newWidth) <
Math.abs(Font2D.FWIDTH_NORMAL - familyWidth))
{
if (FontUtilities.debugFonts()) {
! FontUtilities.getLogger().info(
"Found more preferred width. New width = " + newWidth +
" Old width = " + familyWidth + " in font " + font +
" nulling out fonts plain: " + plain + " bold: " + bold +
" italic: " + italic + " bolditalic: " + bolditalic);
}
familyWidth = newWidth;
plain = bold = italic = bolditalic = null;
return true;
} else if (FontUtilities.debugFonts()) {
! FontUtilities.getLogger().info(
"Family rejecting font " + font +
" of less preferred width " + newWidth);
}
return false;
}
--- 179,199 ----
if (Math.abs(Font2D.FWIDTH_NORMAL - newWidth) <
Math.abs(Font2D.FWIDTH_NORMAL - familyWidth))
{
if (FontUtilities.debugFonts()) {
! FontUtilities.logInfo(
"Found more preferred width. New width = " + newWidth +
" Old width = " + familyWidth + " in font " + font +
" nulling out fonts plain: " + plain + " bold: " + bold +
" italic: " + italic + " bolditalic: " + bolditalic);
}
familyWidth = newWidth;
plain = bold = italic = bolditalic = null;
return true;
} else if (FontUtilities.debugFonts()) {
! FontUtilities.logInfo(
"Family rejecting font " + font +
" of less preferred width " + newWidth);
}
return false;
}
*** 206,216 ****
if (currFont == null) {
return true;
}
if (FontUtilities.debugFonts()) {
! FontUtilities.getLogger().info(
"New weight for style " + style + ". Curr.font=" + currFont +
" New font="+font+" Curr.weight="+ + currFont.getWeight()+
" New weight="+font.getWeight());
}
--- 206,216 ----
if (currFont == null) {
return true;
}
if (FontUtilities.debugFonts()) {
! FontUtilities.logInfo(
"New weight for style " + style + ". Curr.font=" + currFont +
" New font="+font+" Curr.weight="+ + currFont.getWeight()+
" New weight="+font.getWeight());
}
*** 240,258 ****
" with style " + style + " to family " + familyName;
} else {
msg = "Request to add " + font +
" with style " + style + " to family " + this;
}
! FontUtilities.getLogger().info(msg);
}
/* Allow a lower-rank font only if its a file font
* from the exact same source as any previous font.
*/
if ((font.getRank() > familyRank) && !isFromSameSource(font)) {
if (FontUtilities.isLogging()) {
! FontUtilities.getLogger()
! .warning("Rejecting adding " + font +
" of lower rank " + font.getRank() +
" to family " + this +
" of rank " + familyRank);
}
return;
--- 240,257 ----
" with style " + style + " to family " + familyName;
} else {
msg = "Request to add " + font +
" with style " + style + " to family " + this;
}
! FontUtilities.logInfo(msg);
}
/* Allow a lower-rank font only if its a file font
* from the exact same source as any previous font.
*/
if ((font.getRank() > familyRank) && !isFromSameSource(font)) {
if (FontUtilities.isLogging()) {
! FontUtilities.logWarning("Rejecting adding " + font +
" of lower rank " + font.getRank() +
" to family " + this +
" of rank " + familyRank);
}
return;
< prev index next >