2
* Copyright (c) 2001-2005 JGoodies Karsten Lentzsch. All Rights Reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are met:
7
* o Redistributions of source code must retain the above copyright notice,
8
* this list of conditions and the following disclaimer.
10
* o Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
14
* o Neither the name of JGoodies Karsten Lentzsch nor the names of
15
* its contributors may be used to endorse or promote products derived
16
* from this software without specific prior written permission.
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
package org.pushingpixels.substance.internal.contrib.jgoodies.looks;
33
import org.pushingpixels.lafwidget.utils.LookUtils;
36
* Describes font size hints used by the JGoodies Windows look&feel; future
37
* implementations of the Plastic l&f may use the same hints.
40
* These hints are only applied if the dialog font is <em>Tahoma</em>, which is
41
* the default font on the majority of Windows desktops. The hints apply a size
42
* delta to increase or decrease the given system font size.
45
* NOTE: This is work in progress and will probably change in the next release,
46
* to better reflect the font choice in the J2SE 1.4.".
48
* @author Karsten Lentzsch
50
* @see Options#setGlobalFontSizeHints(FontSizeHints)
52
public final class FontSizeHints {
54
public static final FontSizeHints LARGE = new FontSizeHints(12, 12, 14, 14);
55
public static final FontSizeHints SYSTEM = new FontSizeHints(11, 11, 14, 14);
56
public static final FontSizeHints MIXED2 = new FontSizeHints(11, 11, 14, 13);
57
public static final FontSizeHints MIXED = new FontSizeHints(11, 11, 14, 12);
58
public static final FontSizeHints SMALL = new FontSizeHints(11, 11, 12, 12);
59
public static final FontSizeHints FIXED = new FontSizeHints(12, 12, 12, 12);
61
public static final FontSizeHints DEFAULT = SYSTEM;
63
private final int loResMenuFontSize;
64
private final int loResControlFontSize;
65
private final int hiResMenuFontSize;
66
private final int hiResControlFontSize;
69
* Constructs <code>FontSizeHints</code> for the specified menu and control
70
* fonts, both for low and high resolution environments.
72
* @param loResMenuFontSize
73
* the size of the menu font in low resolution
74
* @param loResControlFontSize
75
* the size of the control font in low resolution
76
* @param hiResMenuFontSize
77
* the size of the menu font in low resolution
78
* @param hiResControlFontSize
79
* the size of the control font in low resolution
81
public FontSizeHints(int loResMenuFontSize, int loResControlFontSize,
82
int hiResMenuFontSize, int hiResControlFontSize) {
83
this.loResMenuFontSize = loResMenuFontSize;
84
this.loResControlFontSize = loResControlFontSize;
85
this.hiResMenuFontSize = hiResMenuFontSize;
86
this.hiResControlFontSize = hiResControlFontSize;
90
* Returns the low resolution menu font size.
92
* @return the size of the menu font in low resolution mode
94
public int loResMenuFontSize() {
95
return loResMenuFontSize;
99
* Returns the low resolution control font size.
101
* @return the size of the control font in low resolution mode
103
public int loResControlFontSize() {
104
return loResControlFontSize;
108
* Returns the high resolution menu font size.
110
* @return the size of the menu font in high resolution mode
112
public int hiResMenuFontSize() {
113
return hiResMenuFontSize;
117
* Returns the high resolution control font size.
119
* @return the size of the control font in high resolution mode
121
public int hiResControlFontSize() {
122
return hiResControlFontSize;
126
* Returns the menu font size.
128
* @return the size of the menu font in the current resolution
130
public int menuFontSize() {
131
return LookUtils.IS_LOW_RESOLUTION ? loResMenuFontSize
132
: hiResMenuFontSize();
136
* Returns the control font size.
138
* @return the size of the control font in the current resolution
140
public int controlFontSize() {
141
return LookUtils.IS_LOW_RESOLUTION ? loResControlFontSize
142
: hiResControlFontSize();
146
* Returns the delta between the system menu font size and our menu font
149
* @return the delta between the system menu font size and our menu font
152
public float menuFontSizeDelta() {
153
return menuFontSize() - SYSTEM.menuFontSize();
157
* Returns the delta between system control font size and our control font
160
* @return the delta between the system control font size and our control
163
public float controlFontSizeDelta() {
164
return controlFontSize() - SYSTEM.controlFontSize();
168
* Looksup and returns the <code>FontSizeHints</code> for the specified
172
* the name of the FontSizeHints object
173
* @return the associated FontSizeHints object
175
public static FontSizeHints valueOf(String name) {
176
if (name.equalsIgnoreCase("LARGE"))
178
else if (name.equalsIgnoreCase("SYSTEM"))
180
else if (name.equalsIgnoreCase("MIXED"))
182
else if (name.equalsIgnoreCase("SMALL"))
184
else if (name.equalsIgnoreCase("FIXED"))
187
throw new IllegalArgumentException("Unknown font size hints name: "
b'\\ No newline at end of file'