# Class Font

java.lang.Object
com.codename1.ui.CN1Constants
com.codename1.ui.CN
com.codename1.ui.Font

public class Font extends CN

Codename One currently supports 3 font types:

- System fonts - these are very simplistic builtin fonts. They work on all platforms and come in one of 3 sizes. However, they are ubiquitous and work in every platform in all languages. A system font can be created using `int, int)`.

- TTF files - you can just place a TTF file in the src directory of the project and it will appear in the Codename One Designer as an option. You can load such a font using `java.lang.String)`.

- Native fonts - these aren't supported on all platforms but generally they allow you to use a set of platform native good looking fonts. E.g. on Android the devices Roboto font will be used and on iOS Helvetica Neue will be used. You can load such a font using `java.lang.String)`.

WARNING: If you use a TTF file MAKE SURE not to delete the file when there MIGHT be a reference to it. This can cause hard to track down issues!

IMPORTANT: due to copyright restrictions we cannot distribute Helvetica and thus can't simulate it. In the simulator you will see Roboto as the fallback in some cases and not the device font unless you are running on a Mac. Notice that the Roboto font from Google doesn't support all languages and thus special characters might not work on the simulator but would work on the device.

The sample code below demonstrates a catalog of available fonts, the scr

    private Label createForFont(Font fnt, String s) {
      Label l = new Label(s);
      l.getUnselectedStyle().setFont(fnt);
      return l;
    }

    public void showForm() {
      GridLayout gr = new GridLayout(5);
      gr.setAutoFit(true);
      Form hi = new Form("Fonts", gr);

      int fontSize = Display.getInstance().convertToPixels(3);

      // requires Handlee-Regular.ttf in the src folder root!
      Font ttfFont = Font.createTrueTypeFont("Handlee", "Handlee-Regular.ttf").
                          derive(fontSize, Font.STYLE_PLAIN);

      Font smallPlainSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
      Font mediumPlainSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);
      Font largePlainSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE);
      Font smallBoldSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_SMALL);
      Font mediumBoldSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
      Font largeBoldSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE);
      Font smallItalicSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_SMALL);
      Font mediumItalicSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_MEDIUM);
      Font largeItalicSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_LARGE);

      Font smallPlainMonospaceFont = Font.createSystemFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_SMALL);
      Font mediumPlainMonospaceFont = Font.createSystemFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);
      Font largePlainMonospaceFont = Font.createSystemFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_LARGE);
      Font smallBoldMonospaceFont = Font.createSystemFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_SMALL);
      Font mediumBoldMonospaceFont = Font.createSystemFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
      Font largeBoldMonospaceFont = Font.createSystemFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_LARGE);
      Font smallItalicMonospaceFont = Font.createSystemFont(Font.FACE_MONOSPACE, Font.STYLE_ITALIC, Font.SIZE_SMALL);
      Font mediumItalicMonospaceFont = Font.createSystemFont(Font.FACE_MONOSPACE, Font.STYLE_ITALIC, Font.SIZE_MEDIUM);
      Font largeItalicMonospaceFont = Font.createSystemFont(Font.FACE_MONOSPACE, Font.STYLE_ITALIC, Font.SIZE_LARGE);

      Font smallPlainProportionalFont = Font.createSystemFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_SMALL);
      Font mediumPlainProportionalFont = Font.createSystemFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);
      Font largePlainProportionalFont = Font.createSystemFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_LARGE);
      Font smallBoldProportionalFont = Font.createSystemFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_SMALL);
      Font mediumBoldProportionalFont = Font.createSystemFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
      Font largeBoldProportionalFont = Font.createSystemFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_LARGE);
      Font smallItalicProportionalFont = Font.createSystemFont(Font.FACE_PROPORTIONAL, Font.STYLE_ITALIC, Font.SIZE_SMALL);
      Font mediumItalicProportionalFont = Font.createSystemFont(Font.FACE_PROPORTIONAL, Font.STYLE_ITALIC, Font.SIZE_MEDIUM);
      Font largeItalicProportionalFont = Font.createSystemFont(Font.FACE_PROPORTIONAL, Font.STYLE_ITALIC, Font.SIZE_LARGE);

      String[] nativeFontTypes = {
          "native:MainThin", "native:MainLight", "native:MainRegular", "native:MainBold", "native:MainBlack",
          "native:ItalicThin", "native:ItalicLight", "native:ItalicRegular", "native:ItalicBold", "native:ItalicBlack"};

      for(String s : nativeFontTypes) {
          Font tt  = Font.createTrueTypeFont(s, s).derive(fontSize, Font.STYLE_PLAIN);
          hi.add(createForFont(tt, s));
      }

      hi.add(createForFont(ttfFont, "Handlee TTF Font")).
              add(createForFont(smallPlainSystemFont, "smallPlainSystemFont")).
              add(createForFont(mediumPlainSystemFont, "mediumPlainSystemFont")).
              add(createForFont(largePlainSystemFont, "largePlainSystemFont")).
              add(createForFont(smallBoldSystemFont, "smallBoldSystemFont")).
              add(createForFont(mediumBoldSystemFont, "mediumBoldSystemFont")).
              add(createForFont(largeBoldSystemFont, "largeBoldSystemFont")).
              add(createForFont(smallPlainSystemFont, "smallItalicSystemFont")).
              add(createForFont(mediumItalicSystemFont, "mediumItalicSystemFont")).
              add(createForFont(largeItalicSystemFont, "largeItalicSystemFont")).

              add(createForFont(smallPlainMonospaceFont, "smallPlainMonospaceFont")).
              add(createForFont(mediumPlainMonospaceFont, "mediumPlainMonospaceFont")).
              add(createForFont(largePlainMonospaceFont, "largePlainMonospaceFont")).
              add(createForFont(smallBoldMonospaceFont, "smallBoldMonospaceFont")).
              add(createForFont(mediumBoldMonospaceFont, "mediumBoldMonospaceFont")).
              add(createForFont(largeBoldMonospaceFont, "largeBoldMonospaceFont")).
              add(createForFont(smallItalicMonospaceFont, "smallItalicMonospaceFont")).
              add(createForFont(mediumItalicMonospaceFont, "mediumItalicMonospaceFont")).
              add(createForFont(largeItalicMonospaceFont, "largeItalicMonospaceFont")).

              add(createForFont(smallPlainProportionalFont, "smallPlainProportionalFont")).
              add(createForFont(mediumPlainProportionalFont, "mediumPlainProportionalFont")).
              add(createForFont(largePlainProportionalFont, "largePlainProportionalFont")).
              add(createForFont(smallBoldProportionalFont, "smallBoldProportionalFont")).
              add(createForFont(mediumBoldProportionalFont, "mediumBoldProportionalFont")).
              add(createForFont(largeBoldProportionalFont, "largeBoldProportionalFont")).
              add(createForFont(smallItalicProportionalFont, "smallItalicProportionalFont")).
              add(createForFont(mediumItalicProportionalFont, "mediumItalicProportionalFont")).
              add(createForFont(largeItalicProportionalFont, "largeItalicProportionalFont"));

      hi.show();
    }

The demo code on the iPad simulator on a Mac

The demo code on an Android 5.1 OPO device (OnePlus One)

The Font class also supports bitmap fonts but this support is strictly aimed at legacy applications. We no longer maintain that functionality.

- ## Field Summary

  ### Fields inherited from class CN

  `BASELINE, BOTTOM, CENTER, CENTER_BEHAVIOR_CENTER, CENTER_BEHAVIOR_CENTER_ABSOLUTE, CENTER_BEHAVIOR_SCALE, CENTER_BEHAVIOR_TOTAL_BELOW, EAST, FACE_MONOSPACE, FACE_PROPORTIONAL, FACE_SYSTEM, LEFT, NATIVE_ITALIC_BLACK, NATIVE_ITALIC_BOLD, NATIVE_ITALIC_LIGHT, NATIVE_ITALIC_REGULAR, NATIVE_ITALIC_THIN, NATIVE_MAIN_BLACK, NATIVE_MAIN_BOLD, NATIVE_MAIN_LIGHT, NATIVE_MAIN_REGULAR, NATIVE_MAIN_THIN, NORTH, RIGHT, SIZE_LARGE, SIZE_MEDIUM, SIZE_SMALL, SOUTH, STYLE_BOLD, STYLE_ITALIC, STYLE_PLAIN, STYLE_UNDERLINED, TOP, WEST`
  Modifier and Type
  Field
  Description
  `static final int`
  `BASELINE`
  Alignment to the baseline constraint
  `static final int`
  `BOTTOM`
  Box-orientation constant used to specify the bottom of a box.
  `static final int`
  `CENTER`
  Indicates a Component center alignment
  `static final int`
  `CENTER_BEHAVIOR_CENTER`
  Defines the behavior of the component placed in the center position of the layout, places the component in the center of the space available to the center component.
  `static final int`
  `CENTER_BEHAVIOR_CENTER_ABSOLUTE`
  Defines the behavior of the component placed in the center position of the layout, places the component in the center of the surrounding container
  `static final int`
  `CENTER_BEHAVIOR_SCALE`
  Defines the behavior of the component placed in the center position of the layout, by default it is scaled to the available space
  `static final int`
  `CENTER_BEHAVIOR_TOTAL_BELOW`
  The center component takes up the entire screens and the sides are automatically placed on top of it thus creating a layered effect
  `static final String`
  `EAST`
  The east layout constraint (right of container).
  `static final int`
  `FACE_MONOSPACE`
  Constant allowing us to author portable system fonts
  `static final int`
  `FACE_PROPORTIONAL`
  Constant allowing us to author portable system fonts
  `static final int`
  `FACE_SYSTEM`
  Constant allowing us to author portable system fonts
  `static final int`
  `LEFT`
  Box-orientation constant used to specify the left side of a box.
  `static final String`
  `NATIVE_ITALIC_BLACK`
  Constant for the italic black native font.
  `static final String`
  `NATIVE_ITALIC_BOLD`
  Constant for the italic bold native font.
  `static final String`
  `NATIVE_ITALIC_LIGHT`
  Constant for the italic light native font.
  `static final String`
  `NATIVE_ITALIC_REGULAR`
  Constant for the italic regular native font.
  `static final String`
  `NATIVE_ITALIC_THIN`
  Constant for the italic thin native font.
  `static final String`
  `NATIVE_MAIN_BLACK`
  Constant for the main black native font.
  `static final String`
  `NATIVE_MAIN_BOLD`
  Constant for the main bold native font.
  `static final String`
  `NATIVE_MAIN_LIGHT`
  Constant for the main light native font.
  `static final String`
  `NATIVE_MAIN_REGULAR`
  Constant for the main regular native font.
  `static final String`
  `NATIVE_MAIN_THIN`
  Constant for the name of the main thin native font.
  `static final String`
  `NORTH`
  The north layout constraint (top of container).
  `static final int`
  `RIGHT`
  Box-orientation constant used to specify the right side of a box.
  `static final int`
  `SIZE_LARGE`
  Constant allowing us to author portable system fonts
  `static final int`
  `SIZE_MEDIUM`
  Constant allowing us to author portable system fonts
  `static final int`
  `SIZE_SMALL`
  Constant allowing us to author portable system fonts
  `static final String`
  `SOUTH`
  The south layout constraint (bottom of container).
  `static final int`
  `STYLE_BOLD`
  Constant allowing us to author portable system fonts
  `static final int`
  `STYLE_ITALIC`
  Constant allowing us to author portable system fonts
  `static final int`
  `STYLE_PLAIN`
  Constant allowing us to author portable system fonts
  `static final int`
  `STYLE_UNDERLINED`
  Constant allowing us to author portable system fonts
  `static final int`
  `TOP`
  Box-orientation constant used to specify the top of a box.
  `static final String`
  `WEST`
  The west layout constraint (left of container).

  ### Fields inherited from class CN1Constants

  `DENSITY_2HD, DENSITY_4K, DENSITY_560, DENSITY_HD, DENSITY_HIGH, DENSITY_LOW, DENSITY_MEDIUM, DENSITY_VERY_HIGH, DENSITY_VERY_LOW, GALLERY_ALL, GALLERY_ALL_MULTI, GALLERY_IMAGE, GALLERY_IMAGE_MULTI, GALLERY_VIDEO, GALLERY_VIDEO_MULTI, PICKER_TYPE_CALENDAR, PICKER_TYPE_DATE, PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_DURATION, PICKER_TYPE_DURATION_HOURS, PICKER_TYPE_DURATION_MINUTES, PICKER_TYPE_STRINGS, PICKER_TYPE_TIME, SMS_BOTH, SMS_INTERACTIVE, SMS_NOT_SUPPORTED, SMS_SEAMLESS`
  Modifier and Type
  Field
  Description
  `static final int`
  `DENSITY_2HD`
  Double the HD level density
  `static final int`
  `DENSITY_4K`
  4K level density
  `static final int`
  `DENSITY_560`
  Intermediate density for screens that sit somewhere between HD to 2HD
  `static final int`
  `DENSITY_HD`
  HD Up To 1920x1080
  `static final int`
  `DENSITY_HIGH`
  Hi Density Up To 480x854
  `static final int`
  `DENSITY_LOW`
  Low Density Up To 240x320
  `static final int`
  `DENSITY_MEDIUM`
  Medium Density Up To 360x480
  `static final int`
  `DENSITY_VERY_HIGH`
  Very Hi Density Up To 1440x720
  `static final int`
  `DENSITY_VERY_LOW`
  Very Low Density 176x220 And Smaller
  `static final int`
  `GALLERY_ALL`
  Used by openGallery
  `static final int`
  `GALLERY_ALL_MULTI`
  Used by openGallery
  `static final int`
  `GALLERY_IMAGE`
  Used by openGallery
  `static final int`
  `GALLERY_IMAGE_MULTI`
  Used by openGallery
  `static final int`
  `GALLERY_VIDEO`
  Used by openGallery
  `static final int`
  `GALLERY_VIDEO_MULTI`
  Used by openGallery
  `static final int`
  `PICKER_TYPE_CALENDAR`
  Calendar picker type.
  `static final int`
  `PICKER_TYPE_DATE`
  Date native picker type, it returns a java.util.Date result.
  `static final int`
  `PICKER_TYPE_DATE_AND_TIME`
  Date and time native picker type, it returns a java.util.Date result.
  `static final int`
  `PICKER_TYPE_DURATION`
  Duration picker type.
  `static final int`
  `PICKER_TYPE_DURATION_HOURS`
  Duration picker type.
  `static final int`
  `PICKER_TYPE_DURATION_MINUTES`
  Duration picker type.
  `static final int`
  `PICKER_TYPE_STRINGS`
  Strings native picker type, it returns a String result and accepts a String array.
  `static final int`
  `PICKER_TYPE_TIME`
  Time native picker type, it returns an integer with minutes since midnight.
  `static final int`
  `SMS_BOTH`
  Used by getSMSSupport to indicate that SMS can be sent in either seamless or interactive mode
  `static final int`
  `SMS_INTERACTIVE`
  Used by getSMSSupport to indicate that SMS triggers the native SMS app which will show a compose UI
  `static final int`
  `SMS_NOT_SUPPORTED`
  Used by getSMSSupport to indicate that SMS is not supported
  `static final int`
  `SMS_SEAMLESS`
  Used by getSMSSupport to indicate that SMS is sent in the background without a compose UI

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addContrast(byte value)`
  Increase the contrast of the bitmap font for rendering on top of a surface whose color is darker.
  `int`
  `charsWidth(char[] ch, int offset, int length)`
  Return the width of the given characters in this font instance
  `int`
  `charWidth(char ch)`
  Return the width of the specific character when rendered alone
  `static void`
  `clearBitmapCache()`
  Bitmap fonts are cached this method allows us to flush the cache thus allows us to reload a font
  `static Font`
  `create(String lookup)`
  Creates a new font instance based on the platform specific string name of the font.
  `static Font`
  `createBitmapFont(Image bitmap, int[] cutOffsets, int[] charWidth, String charsets)`
  Creates a bitmap font with the given arguments
  `static Font`
  `createBitmapFont(String name, Image bitmap, int[] cutOffsets, int[] charWidth, String charsets)`
  Creates a bitmap font with the given arguments and places said font in the cache
  `static Font`
  `createSystemFont(int face, int style, int size)`
  Creates a system native font in a similar way to common MIDP fonts
  `static Font`
  `createTrueTypeFont(String fontName)`
  Shorthand for `createTrueTypeFont(name, name)` which is useful for cases such as native: fonts.
  `static Font`
  `createTrueTypeFont(String fontName, float sizeMm)`
  Shorthand for `createTrueTypeFont(name, name)` & `derive(size)` which is useful for cases such as native: fonts.
  `static Font`
  `createTrueTypeFont(String fontName, float size, byte sizeUnit)`
  Shorthand for `createTrueTypeFont(name, name)` & `derive(size)` which is useful for cases such as native: fonts.
  `static Font`
  `createTrueTypeFont(String fontName, String fileName)`
  Creates a true type font with the given name/filename (font name might be different from the file name and is required by some devices e.g. iOS).
  `Font`
  `derive(float sizePixels, int weight)`
  Creates a font based on this truetype font with the given pixel, WARNING! This method will only work in the case of truetype fonts!
  `Font`
  `derive(float size, int weight, byte unitType)`
  Creates a font based on this truetype font with the given pixel, WARNING! This method will only work in the case of truetype fonts!
  `boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `int`
  `getAscent()`
  The ascent is the amount by which the character ascends above the baseline.
  `static Font`
  `getBitmapFont(String fontName)`
  Returns a previously loaded bitmap font from cache
  `String`
  `getCharset()`
  Returns a string containing all the characters supported by this font.
  `static Font`
  `getDefaultFont()`
  Return the global default font instance
  `int`
  `getDescent()`
  The descent is the amount by which the character descends below the baseline
  `int`
  `getFace()`
  Return Optional operation returning the font face for system fonts
  `int`
  `getHeight()`
  Return the total height of the font
  `Object`
  `getNativeFont()`
  Returns the internal implementation specific font object
  `float`
  `getPixelSize()`
  Returns the size with which the font object was created in case of truetype fonts/derived fonts.
  `int`
  `getSize()`
  Return Optional operation returning the font size for system fonts
  `int`
  `getStyle()`
  Return Optional operation returning the font style for system fonts
  `int`
  `hashCode()`
  Returns a hash code value for the object.
  `static boolean`
  `isBitmapFontEnabled()`
  Indicates whether bitmap fonts should be enabled when loading or the fallback system font should be used instead.
  `static boolean`
  `isCreationByStringSupported()`
  Returns true if the underlying platform allows creating a font based on a user submitted string.
  `static boolean`
  `isNativeFontSchemeSupported()`
  Indicates whether the implementation supports loading a font "natively" to handle one of the common native prefixes
  `static boolean`
  `isTrueTypeFileSupported()`
  Returns true if the underlying platform supports loading truetype fonts from a file.
  `boolean`
  `isTTFNativeFont()`
  Indicates if this is a TTF native font that can be derived and manipulated.
  `static void`
  `setBitmapFontEnabled(boolean enabled)`
  Indicates whether bitmap fonts should be enabled by default when loading or the fallback system font should be used instead.
  `static void`
  `setDefaultFont(Font f)`
  Sets the global default font instance
  `int`
  `stringWidth(String str)`
  Return the width of the given string in this font instance
  `int`
  `substringWidth(String str, int offset, int len)`
  Return the width of the given string subset in this font instance

  ### Methods inherited from class CN

  `addDefaultHeader, addEdtErrorHandler, addMessageListener, addNetworkErrorListener, addNetworkProgressListener, addToQueue, addToQueueAndWait, addWindowListener, announceForAccessibility, announceForAccessibility, callSerially, callSeriallyAndWait, callSeriallyAndWait, callSeriallyOnIdle, canDial, canExecute, canForceOrientation, canInstallOnHomescreen, captureScreen, clearStorage, clearStorageCache, convertToPixels, convertToPixels, convertToPixels, convertToPixels, createSoftWeakRef, createStorageInputStream, createStorageOutputStream, createThread, delete, deleteStorageFile, deregisterPush, dial, execute, existsInFileSystem, existsInStorage, exitApplication, exitFullScreen, extractHardRef, flushStorageCache, getAppHomePath, getCachesDir, getCurrentForm, getDesktopSize, getDeviceDensity, getDisplayHeight, getDisplayWidth, getDragStartPercentage, getFileLastModifiedFile, getFileLength, getFileSystemRootAvailableSpace, getFileSystemRoots, getFileSystemRootSizeBytes, getFileSystemRootType, getInitialWindowSizeHintPercent, getPlatformName, getPluginSupport, getProperty, getResourceAsStream, getSharedJavascriptContext, getSMSSupport, getWindowBounds, hasCachesDir, hasCamera, invokeAndBlock, invokeWithoutBlocking, invokeWithoutBlockingWithResultSync, isDarkMode, isDesktop, isDirectory, isEdt, isEnableAsyncStackTraces, isFullScreenSupported, isHiddenFile, isInFullScreenMode, isLockOrientation, isMinimized, isNativePickerTypeSupported, isNativeShareSupported, isPortrait, isScreenSaverDisableSupported, isSimulator, isTablet, killAndWait, listFiles, listStorageEntries, lockOrientation, log, log, minimizeApplication, mkdir, onCanInstallOnHomescreen, openFileInputStream, openFileOutputStream, openFileOutputStream, openGallery, postMessage, promptInstallOnHomescreen, readObjectFromStorage, registerPush, removeEdtErrorHandler, removeMessageListener, removeNetworkErrorListener, removeNetworkProgressListener, removeWindowListener, renameFile, requestFullScreen, restoreMinimizedApplication, restoreToBookmark, scheduleBackgroundTask, sendLog, sendMessage, sendSMS, sendSMS, setBookmark, setDarkMode, setDragStartPercentage, setEnableAsyncStackTraces, setHiddenFile, setInitialWindowSizeHintPercent, setInterval, setProperty, setScreenSaverEnabled, setTimeout, setWindowSize, share, share, showNativePicker, startThread, storageEntrySize, unlockOrientation, updateNetworkThreadCount, vibrate, writeObjectToStorage`
  Modifier and Type
  Method
  Description
  `static void`
  `addDefaultHeader(String key, String value)`
  Adds a header to the global default headers, this header will be implicitly added to all requests going out from this point onwards.
  `static void`
  `addEdtErrorHandler(ActionListener e)`
  An error handler will receive an action event with the source exception from the EDT once an error handler is installed the default Codename One error dialog will no longer appear
  `static void`
  `addMessageListener(ActionListener<MessageEvent> l)`
  Adds a listener to receive messages from the native platform.
  `static void`
  `addNetworkErrorListener(ActionListener<NetworkEvent> e)`
  Adds a generic listener to a network error that is invoked before the exception is propagated.
  `static void`
  `addNetworkProgressListener(ActionListener<NetworkEvent> al)`
  Adds a listener to be notified when progress updates
  `static void`
  `addToQueue(ConnectionRequest request)`
  Adds the given network connection to the queue of execution
  `static void`
  `addToQueueAndWait(ConnectionRequest request)`
  Identical to add to queue but waits until the request is processed in the queue, this is useful for completely synchronous operations.
  `static void`
  `addWindowListener(ActionListener<WindowEvent> l)`
  Adds a listener for window events such as resize or move.
  `static void`
  `announceForAccessibility(Component cmp, String text)`
  Manually announces text to native accessibility services, optionally associating the announcement with a specific component.
  `static void`
  `announceForAccessibility(String text)`
  Convenience overload to announce text without specifying a component.
  `static void`
  `callSerially(Runnable r)`
  Causes the runnable to be invoked on the event dispatch thread.
  `static void`
  `callSeriallyAndWait(Runnable r)`
  Identical to callSerially with the added benefit of waiting for the Runnable method to complete.
  `static void`
  `callSeriallyAndWait(Runnable r, int timeout)`
  Identical to callSerially with the added benefit of waiting for the Runnable method to complete.
  `static void`
  `callSeriallyOnIdle(Runnable r)`
  Causes the runnable to be invoked on the event dispatch thread when the event dispatch thread is idle.
  `static boolean`
  `canDial()`
  Returns true if the device has dialing capabilities
  `static Boolean`
  `canExecute(String url)`
  Returns true if executing this URL should work, returns false if it will not and null if this is unknown.
  `static boolean`
  `canForceOrientation()`
  Returns true if the device allows forcing the orientation via code, feature phones do not allow this although some include a jad property allowing for this feature
  `static boolean`
  `canInstallOnHomescreen()`
  Checks to see if you can prompt the user to install the app on their homescreen.
  `static Image`
  `captureScreen()`
  Captures a screenshot of the screen.
  `static void`
  `clearStorage()`
  Deletes all the files in the application storage
  `static void`
  `clearStorageCache()`
  Storage is cached for faster access, however this might cause a problem with refreshing objects since they are not cloned.
  `static int`
  `convertToPixels(float dipCount)`
  Converts the dips count to pixels, dips are roughly 1mm in length.
  `static int`
  `convertToPixels(float value, byte unitType)`
  Converts from specified unit to pixels.
  `static int`
  `convertToPixels(float value, byte unitType, boolean horizontal)`
  Converts from specified unit to pixels.
  `static int`
  `convertToPixels(int dipCount, boolean horizontal)`
  Converts the dips count to pixels, dips are roughly 1mm in length.
  `static Object`
  `createSoftWeakRef(Object o)`
  Creates a soft/weak reference to an object that allows it to be collected yet caches it.
  `static InputStream`
  `createStorageInputStream(String name)`
  Creates an input stream to the given storage source file
  `static OutputStream`
  `createStorageOutputStream(String name)`
  Creates an output stream to the storage with the given name
  `static Thread`
  `createThread(Runnable r, String name)`
  Start a Codename One thread that supports crash protection and similar Codename One features.
  `static void`
  `delete(String file)`
  Deletes the specific file or empty directory.
  `static void`
  `deleteStorageFile(String name)`
  Deletes the given file name from the storage
  `static void`
  `deregisterPush()`
  Stop receiving push notifications to this client application
  `static void`
  `dial(String phoneNumber)`
  Opens the device Dialer application with the given phone number
  `static void`
  `execute(String url)`
  Executes the given URL on the native platform
  `static boolean`
  `existsInFileSystem(String file)`
  Indicates whether a file exists
  `static boolean`
  `existsInStorage(String name)`
  Returns true if the given storage file exists
  `static void`
  `exitApplication()`
  Exits the application...
  `static boolean`
  `exitFullScreen()`
  Try to exit full-screen mode if the platform supports it.
  `static Object`
  `extractHardRef(Object o)`
  Extracts the hard reference from the soft/weak reference given
  `static void`
  `flushStorageCache()`
  Flush the storage cache allowing implementations that cache storage objects to store
  `static String`
  `getAppHomePath()`
  The application home directory is a "safe place" to store files for this application in a portable way.
  `static String`
  `getCachesDir()`
  Returns a device specific directory designed for cache style files, or null if `#hasCachesDir()` is false
  `static Form`
  `getCurrentForm()`
  Return the form currently displayed on the screen or null if no form is currently displayed.
  `static Dimension`
  `getDesktopSize()`
  Returns the size of the desktop hosting the application window when running on a desktop platform.
  `static int`
  `getDeviceDensity()`
  Returns one of the density variables appropriate for this device, notice that density doesn't always correspond to resolution and an implementation might decide to change the density based on DPI constraints.
  `static int`
  `getDisplayHeight()`
  Return the height of the display
  `static int`
  `getDisplayWidth()`
  Return the width of the display
  `static int`
  `getDragStartPercentage()`
  This method allows us to manipulate the drag started detection logic.
  `static long`
  `getFileLastModifiedFile(String file)`
  Returns the time that the file denoted by this abstract pathname was last modified.
  `static long`
  `getFileLength(String file)`
  Returns the length of the file
  `static long`
  `getFileSystemRootAvailableSpace(String root)`
  Returns the available space in the given root directory
  `static String[]`
  `getFileSystemRoots()`
  Returns the filesystem roots from which the structure of the file system can be traversed
  `static long`
  `getFileSystemRootSizeBytes(String root)`
  Returns the size of the given root directory
  `static int`
  `getFileSystemRootType(String root)`
  Returns the type of the root often by guessing
  `static Dimension`
  `getInitialWindowSizeHintPercent()`
  Returns the initial desktop window size hint provided by the first shown form, when available.
  `static String`
  `getPlatformName()`
  Returns a 2-3 letter code representing the platform name for the platform override
  `static PluginSupport`
  `getPluginSupport()`
  Returns the plugin support object for the current platform.
  `static String`
  `getProperty(String key, String defaultValue)`
  Returns the property from the underlying platform deployment or the default value if no deployment values are supported.
  `static InputStream`
  `getResourceAsStream(String resource)`
  This method is essentially equivalent to cls.getResourceAsStream(String) however some platforms might define unique ways in which to load resources within the implementation.
  `static BrowserComponent`
  `getSharedJavascriptContext()`
  Gets a reference to an application-wide shared Javascript context that can be used for running Javascript commands.
  `static int`
  `getSMSSupport()`
  Indicates the level of SMS support in the platform as one of: `#SMS_NOT_SUPPORTED` (for desktop, tablet etc.), `#SMS_SEAMLESS` (no UI interaction), `#SMS_INTERACTIVE` (with compose UI), `#SMS_BOTH`.
  `static Rectangle`
  `getWindowBounds()`
  Returns the number of monitors attached to the desktop environment when available.
  `static boolean`
  `hasCachesDir()`
  Returns true if the device has a directory dedicated for "cache" files
  `static boolean`
  `hasCamera()`
  Returns true if the device has camera false otherwise.
  `static void`
  `invokeAndBlock(Runnable r)`
  Invokes runnable and blocks the current thread, if the current thread is the EDT it will still be blocked in a way that doesn't break event dispatch .
  `static void`
  `invokeWithoutBlocking(Runnable r)`
  Invokes a Runnable with blocking disabled.
  `static <T> T`
  `invokeWithoutBlockingWithResultSync(RunnableWithResultSync<T> r)`
  Invokes a RunnableWithResultSync with blocking disabled.
  `static Boolean`
  `isDarkMode()`
  Returns true if the platform is in dark mode, null is returned for unknown status
  `static boolean`
  `isDesktop()`
  Returns true if this is a desktop application
  `static boolean`
  `isDirectory(String file)`
  Indicates whether the given file is a directory
  `static boolean`
  `isEdt()`
  Returns true if we are currently in the event dispatch thread.
  `static boolean`
  `isEnableAsyncStackTraces()`
  Checks if async stack traces are enabled.
  `static boolean`
  `isFullScreenSupported()`
  Checks if this platform supports full-screen mode.
  `static boolean`
  `isHiddenFile(String file)`
  Indicates the hidden state of the file
  `static boolean`
  `isInFullScreenMode()`
  Checks if the app is currently running in full-screen mode.
  `static boolean`
  `isLockOrientation()`
  Returns true if orientation was locked using #lockOrientation(boolean) and not yet unlocked via #unlockOrientation().
  `static boolean`
  `isMinimized()`
  Indicates whether an application is minimized
  `static boolean`
  `isNativePickerTypeSupported(int pickerType)`
  Indicates whether the native picker dialog is supported for the given type which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATE
  `static boolean`
  `isNativeShareSupported()`
  Indicates if the underlying platform supports sharing capabilities
  `static boolean`
  `isPortrait()`
  Returns true if the device is currently in portrait mode
  `static boolean`
  `isScreenSaverDisableSupported()`
  Checks if the device supports disabling the screen display from dimming, allowing the developer to keep the screen display on.
  `static boolean`
  `isSimulator()`
  Allows detecting development mode so debugging code and special cases can be used to simplify flow
  `static boolean`
  `isTablet()`
  Indicates whether the device is a tablet, notice that this is often a guess
  `static void`
  `killAndWait(ConnectionRequest request)`
  Kills the given request and waits until the request is killed if it is being processed by one of the threads.
  `static String[]`
  `listFiles(String directory)`
  Lists the files within the given directory, returns relative file names and not full file names.
  `static String[]`
  `listStorageEntries()`
  Lists the names of the storage files
  `static void`
  `lockOrientation(boolean portrait)`
  On devices that return true for canForceOrientation() this method can lock the device orientation either to portrait or landscape mode
  `static void`
  `log(String s)`
  Prints to the log
  `static void`
  `log(Throwable s)`
  Prints to the log
  `static boolean`
  `minimizeApplication()`
  Minimizes the current application if minimization is supported by the platform (may fail).
  `static void`
  `mkdir(String directory)`
  Creates the given directory
  `static void`
  `onCanInstallOnHomescreen(Runnable r)`
  A callback fired when you are allowed to prompt the user to install the app on their homescreen.
  `static InputStream`
  `openFileInputStream(String file)`
  Opens an input stream to the given file
  `static OutputStream`
  `openFileOutputStream(String file)`
  Opens an output stream to the given file
  `static OutputStream`
  `openFileOutputStream(String file, int offset)`
  Opens an output stream to the given file
  `static void`
  `openGallery(ActionListener response, int type)`
  Opens the device gallery to pick an image or a video.
  `static void`
  `postMessage(MessageEvent message)`
  Posts a message to the native platform.
  `static boolean`
  `promptInstallOnHomescreen()`
  Prompts the user to install this app on their homescreen.
  `static Object`
  `readObjectFromStorage(String name)`
  Reads the object from the storage, returns null if the object isn't there
  `static void`
  `registerPush()`
  Register to receive push notification, invoke this method once (ever) to receive push notifications.
  `static void`
  `removeEdtErrorHandler(ActionListener e)`
  An error handler will receive an action event with the source exception from the EDT once an error handler is installed the default Codename One error dialog will no longer appear
  `static void`
  `removeMessageListener(ActionListener<MessageEvent> l)`
  Removes a listener from receiving messages from the native platform.
  `static void`
  `removeNetworkErrorListener(ActionListener<NetworkEvent> e)`
  Removes the given error listener
  `static void`
  `removeNetworkProgressListener(ActionListener<NetworkEvent> al)`
  Adds a listener to be notified when progress updates
  `static void`
  `removeWindowListener(ActionListener<WindowEvent> l)`
  Removes a previously registered window listener.
  `static void`
  `renameFile(String file, String newName)`
  Renames a file to the given name, expects the new name to be relative to the current directory
  `static boolean`
  `requestFullScreen()`
  Try to enter full-screen mode if the platform supports it.
  `static void`
  `restoreMinimizedApplication()`
  Restore the minimized application if minimization is supported by the platform
  `static void`
  `restoreToBookmark()`
  Runs the last bookmark that was set using `#setBookmark(java.lang.Runnable)`
  `static void`
  `scheduleBackgroundTask(Runnable r)`
  Allows executing a background task in a separate low priority thread.
  `static void`
  `sendLog()`
  Sends the log to your email account
  `static void`
  `sendMessage(String subject, Message msg, String... recipients)`
  Send an email using the platform mail client.
  `static void`
  `sendSMS(String phoneNumber, String message)`
  Sends a SMS message to the given phone number
  `static void`
  `sendSMS(String phoneNumber, String message, boolean interactive)`
  Sends a SMS message to the given phone number, the code below demonstrates the logic of detecting platform behavior for sending SMS.
  `static void`
  `setBookmark(Runnable bookmark)`
  Sets a bookmark that can restore the app to a particular state.
  `static void`
  `setDarkMode(Boolean darkMode)`
  Override the default dark mode setting
  `static void`
  `setDragStartPercentage(int dragStartPercentage)`
  This method allows us to manipulate the drag started detection logic.
  `static void`
  `setEnableAsyncStackTraces(boolean enable)`
  Enables or disables async stack traces.
  `static void`
  `setHiddenFile(String file, boolean h)`
  Toggles the hidden state of the file
  `static void`
  `setInitialWindowSizeHintPercent(Dimension hint)`
  Sets the initial desktop window size hint (percent of the desktop) that should be used when the first form is shown.
  `static Timer`
  `setInterval(int timeout, Runnable r)`
  Convenience method to schedule a task to run on the EDT after periodms repeating every periodms.
  `static void`
  `setProperty(String key, String value)`
  Sets a local property to the application, this method has no effect on the implementation code and only allows the user to override the logic of getProperty for internal application purposes.
  `static void`
  `setScreenSaverEnabled(boolean e)`
  If isScreenSaverDisableSupported() returns true calling this method will lock the screen display on
  `static Timer`
  `setTimeout(int timeout, Runnable r)`
  Convenience method to schedule a task to run on the EDT after timeoutms.
  `static void`
  `setWindowSize(int width, int height)`
  Requests a resize of the application window when supported by the platform.
  `static void`
  `share(String text, String image, String mimeType)`
  Share the required information using the platform sharing services.
  `static void`
  `share(String text, String image, String mimeType, Rectangle sourceRect)`
  Share the required information using the platform sharing services.
  `static Object`
  `showNativePicker(int type, Component source, Object currentValue, Object data)`
  Shows a native modal dialog allowing us to perform the picking for the given type which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATE
  `static Thread`
  `startThread(Runnable r, String name)`
  Start a Codename One thread that supports crash protection and similar Codename One features.
  `static int`
  `storageEntrySize(String name)`
  Returns the size in bytes of the given entry
  `static void`
  `unlockOrientation()`
  This is the reverse method for lock orientation allowing orientation lock to be disabled
  `static void`
  `updateNetworkThreadCount(int threadCount)`
  Sets the number of network threads and restarts the network threads
  `static void`
  `vibrate(int duration)`
  Vibrates the device for the given length of time, notice that this might ignore the time value completely on some OS's where this level of control isn't supported e.g.
  `static boolean`
  `writeObjectToStorage(String name, Object o)`
  Writes the given object to storage assuming it is an externalizable type or one of the supported types.

  ### Methods inherited from class Object

  `clone, getClass, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  `final Class`
  `getClass()`
  Returns the runtime class of an object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes current thread to wait until another thread invokes the method or the method for this object.
  `final void`
  `wait(long timeout)`
  Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
  `final void`
  `wait(long timeout, int nanos)`
  Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

- ## Method Details

  - ### getBitmapFont

    public static Font getBitmapFont(String fontName)

    Returns a previously loaded bitmap font from cache

    ###### Parameters

    - `fontName`: the font name is the logical name of the font

    ###### Returns

    the font object

    ###### Deprecated

    bitmap font functionality is now deprecated

    ###### See also

    - #clearBitmapCache

  - public static void clearBitmapCache()

    Bitmap fonts are cached this method allows us to flush the cache thus allows us to reload a font

    ###### Deprecated

    bitmap font functionality is now deprecated

  - ### isTrueTypeFileSupported

    public static boolean isTrueTypeFileSupported()

    Returns true if the underlying platform supports loading truetype fonts from a file.

    ###### Returns

    Returns:
      true if the underlying platform supports loading truetype fonts from a file

  - ### isCreationByStringSupported

    public static boolean isCreationByStringSupported()

    Returns true if the underlying platform allows creating a font based on a user submitted string.

    ###### Returns

    Returns:
      true if the underlying platform allows creating a font based on a user submitted string

  - ### isNativeFontSchemeSupported

    public static boolean isNativeFontSchemeSupported()

    Indicates whether the implementation supports loading a font "natively" to handle one of the common native prefixes

    ###### Returns

    true if the "native:" prefix is supported by loadTrueTypeFont

  - ### createTrueTypeFont

    public static Font createTrueTypeFont(String fontName)

    Shorthand for `createTrueTypeFont(name, name)` which is useful for cases such as native: fonts. If a TTF file is passed this method will throw an exception!

    ###### Parameters

    - `fontName`: the native font name. Notice that TTF file names are prohibited

    ###### Returns

    a font object

  - ### createTrueTypeFont

    public static Font createTrueTypeFont(String fontName, float sizeMm)

    Shorthand for `createTrueTypeFont(name, name)` & `derive(size)` which is useful for cases such as native: fonts.

    ###### Parameters

    - `fontName`: the native font name

    - `sizeMm`: the size in mm

    ###### Returns

    a font object

  - ### createTrueTypeFont

    public static Font createTrueTypeFont(String fontName, float size, byte sizeUnit)

    Shorthand for `createTrueTypeFont(name, name)` & `derive(size)` which is useful for cases such as native: fonts.

    ###### Parameters

    - `fontName`: the native font name

    - `size`: the size in the specified unit.

    - `sizeUnit`: @param sizeUnit The unit type of the size. One of `com.codename1.ui.plaf.Style#UNIT_TYPE_DIPS`,

    -                 `com.codename1.ui.plaf.Style#UNIT_TYPE_PIXELS`,

    -                 `com.codename1.ui.plaf.Style#UNIT_TYPE_REM`,

    -                 `com.codename1.ui.plaf.Style#UNIT_TYPE_VW`,

    -                 `com.codename1.ui.plaf.Style#UNIT_TYPE_VH`,

    -                 `com.codename1.ui.plaf.Style#UNIT_TYPE_VMIN`,

    -                 `com.codename1.ui.plaf.Style#UNIT_TYPE_VMAX`.

    ###### Returns

    a font object

    ###### Since

    8.0

  - ### createTrueTypeFont

    public static Font createTrueTypeFont(String fontName, String fileName)

    Creates a true type font with the given name/filename (font name might be different from the file name and is required by some devices e.g. iOS). The font file must reside in the src root of the project in order to be detectable. The file name should contain no slashes or any such value.

    Important some platforms e.g. iOS don't support changing the weight of the font and require you to use the font name matching the weight, so the weight argument to derive will be ignored!

    This system also supports a special "native:" prefix that uses system native fonts e.g. HelveticaNeue on iOS and Roboto on Android. It supports the following types: native:MainThin, native:MainLight, native:MainRegular, native:MainBold, native:MainBlack, native:ItalicThin, native:ItalicLight, native:ItalicRegular, native:ItalicBold, native:ItalicBlack. Important due to copyright restrictions we cannot distribute Helvetica and thus can't simulate it. In the simulator you will see Roboto and not the device font unless you are running on a Mac

    ###### Parameters

    - `fontName`: the name of the font

    - `fileName`: the file name of the font as it appears in the src directory of the project, it MUST end with the .ttf extension!

    ###### Returns

    the font object created or null if true type fonts aren't supported on this platform

  - ### create

    public static Font create(String lookup)

    Creates a new font instance based on the platform specific string name of the font. This method isn't supported on some platforms.

    ###### Parameters

    - `lookup`: @param lookup a set of platform specific names delimited by commas, the first succefully loaded font will be used

    ###### Returns

    newly created font or null if creation failed

  - ### createBitmapFont

    public static Font createBitmapFont(String name, Image bitmap, int[] cutOffsets, int[] charWidth, String charsets)

    Creates a bitmap font with the given arguments and places said font in the cache

    ###### Parameters

    - `name`: the name for the font in the cache

    - `bitmap`: a transparency map in red and black that indicates the characters

    - `cutOffsets`: character offsets matching the bitmap pixels and characters in the font

    - `charWidth`: @param charWidth The width of the character when drawing... this should not be confused with the number of `cutOffset[o + 1] - cutOffset[o]`. They are completely different since a character can be "wider" and "seep" into the next region. This is especially true with italic characters all of which "lean" outside of their bounds.

    - `charsets`: the set of characters in the font

    ###### Returns

    a font object to draw bitmap fonts

    ###### Deprecated

    bitmap font functionality is now deprecated

  - ### createBitmapFont

    public static Font createBitmapFont(Image bitmap, int[] cutOffsets, int[] charWidth, String charsets)

    Creates a bitmap font with the given arguments

    ###### Parameters

    - `bitmap`: a transparency map in red and black that indicates the characters

    - `cutOffsets`: character offsets matching the bitmap pixels and characters in the font

    - `charWidth`: @param charWidth The width of the character when drawing... this should not be confused with the number of `cutOffset[o + 1] - cutOffset[o]`. They are completely different since a character can be "wider" and "seep" into the next region. This is especially true with italic characters all of which "lean" outside of their bounds.

    - `charsets`: the set of characters in the font

    ###### Returns

    a font object to draw bitmap fonts

    ###### Deprecated

    bitmap font functionality is now deprecated

  - ### createSystemFont

    public static Font createSystemFont(int face, int style, int size)

    Creates a system native font in a similar way to common MIDP fonts

    ###### Parameters

    - `face`: One of FACE_SYSTEM, FACE_PROPORTIONAL, FACE_MONOSPACE

    - `style`: one of STYLE_PLAIN, STYLE_ITALIC, STYLE_BOLD

    - `size`: One of SIZE_SMALL, SIZE_MEDIUM, SIZE_LARGE

    ###### Returns

    A newly created system font instance

  - ### getDefaultFont

    public static Font getDefaultFont()

    Return the global default font instance

    ###### Returns

    the global default font instance

  - ### setDefaultFont

    public static void setDefaultFont(Font f)

    Sets the global default font instance

    ###### Parameters

    - `f`: the global default font instance

  - ### isBitmapFontEnabled

    public static boolean isBitmapFontEnabled()

    Indicates whether bitmap fonts should be enabled when loading or the fallback system font should be used instead. This allows easy toggling of font loading.

    ###### Returns

    true by default indicating that bitmap font loading is enabled

  - ### setBitmapFontEnabled

    public static void setBitmapFontEnabled(boolean enabled)

    Indicates whether bitmap fonts should be enabled by default when loading or the fallback system font should be used instead. This allows easy toggling of font loading.

    ###### Parameters

    - `enabled`: true to enable bitmap font loading (if they exist in the resource)

  - ### derive

    public Font derive(float size, int weight, byte unitType)

    Creates a font based on this truetype font with the given pixel, WARNING! This method will only work in the case of truetype fonts!

    Important some platforms e.g. iOS don't support changing the weight of the font and require you to use the font name matching the weight, so the weight argument to derive will be ignored!

    ###### Parameters

    - `size`: the size of the font in the specified unit type.

    - `weight`: PLAIN, BOLD or ITALIC weight based on the constants in this class

    - `unitType`: @param unitType The unit type of the size. One of `com.codename1.ui.plaf.Style#UNIT_TYPE_DIPS`, `com.codename1.ui.plaf.Style#UNIT_TYPE_PIXELS`, `com.codename1.ui.plaf.Style#UNIT_TYPE_REM`, `com.codename1.ui.plaf.Style#UNIT_TYPE_VW`, `com.codename1.ui.plaf.Style#UNIT_TYPE_VH`, `com.codename1.ui.plaf.Style#UNIT_TYPE_VMIN`, `com.codename1.ui.plaf.Style#UNIT_TYPE_VMAX`.

    ###### Returns

    scaled font instance

    ###### Since

    8.0

  - ### derive

    public Font derive(float sizePixels, int weight)

    Creates a font based on this truetype font with the given pixel, WARNING! This method will only work in the case of truetype fonts!

    Important some platforms e.g. iOS don't support changing the weight of the font and require you to use the font name matching the weight, so the weight argument to derive will be ignored!

    ###### Parameters

    - `sizePixels`: the size of the font in pixels

    - `weight`: PLAIN, BOLD or ITALIC weight based on the constants in this class

    ###### Returns

    scaled font instance

  - ### isTTFNativeFont

    public boolean isTTFNativeFont()

    Indicates if this is a TTF native font that can be derived and manipulated. This is true for a font loaded from file (TTF) or using the native: font name

    ###### Returns

    true if this is a native font

  - ### addContrast

    public void addContrast(byte value)

    Increase the contrast of the bitmap font for rendering on top of a surface whose color is darker. This is useful when drawing anti-aliased bitmap fonts using a light color (e.g. white) on top of a dark surface (e.g. black), the font often breaks down if its contrast is not increased due to the way alpha blending appears to the eye.

    Notice that this method only works in one way, contrast cannot be decreased properly in a font and it should be cleared and reloaed with a Look and Feel switch.

    ###### Parameters

    - `value`: the value to increase

    ###### Deprecated

    bitmap font functionality is now deprecated

  - ### charsWidth

    public int charsWidth(char[] ch, int offset, int length)

    Return the width of the given characters in this font instance

    ###### Parameters

    - `ch`: array of characters

    - `offset`: characters offsets

    - `length`: characters length

    ###### Returns

    the width of the given characters in this font instance

  - ### substringWidth

    public int substringWidth(String str, int offset, int len)

    Return the width of the given string subset in this font instance

    ###### Parameters

    - `str`: the given string

    - `offset`: the string offset

    - `len`: the len od string

    ###### Returns

    the width of the given string subset in this font instance

  - ### stringWidth

    public int stringWidth(String str)

    Return the width of the given string in this font instance

    ###### Parameters

    - `str`: the given string *

    ###### Returns

    the width of the given string in this font instance

  - ### charWidth

    public int charWidth(char ch)

    Return the width of the specific character when rendered alone

    ###### Parameters

    - `ch`: the specific character

    ###### Returns

    the width of the specific character when rendered alone

  - ### getHeight

    public int getHeight()

    Return the total height of the font

    ###### Returns

    the total height of the font

  - ### getFace

    public int getFace()

    Return Optional operation returning the font face for system fonts

    ###### Returns

    Optional operation returning the font face for system fonts

  - ### getSize

    public int getSize()

    Return Optional operation returning the font size for system fonts

    ###### Returns

    Optional operation returning the font size for system fonts

  - ### getStyle

    public int getStyle()

    Return Optional operation returning the font style for system fonts

    ###### Returns

    Optional operation returning the font style for system fonts

  - ### getCharset

    public String getCharset()

    Returns a string containing all the characters supported by this font. Will return null for system fonts.

    ###### Returns

    Returns:
      String containing the characters supported by a bitmap font or null otherwise.

  - ### getNativeFont

    public Object getNativeFont()

    Returns the internal implementation specific font object

    ###### Returns

    platform specific font object for use by implementation classes or native code

  - ### equals

    public boolean equals(Object o)
    Indicates whether some other object is "equal to" this one. The equals method implements an equivalence relation: It is reflexive: for any reference value x, x.equals(x) should return true. It is symmetric: for any reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true. It is transitive: for any reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true. It is consistent: for any reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the object is modified. For any non-null reference value x, x.equals(null) should return false. The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable. The general contract of hashCode is: Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables. As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
    Overrides:
      `hashCode` in class `Object`

  - ### getAscent

    public int getAscent()

    The ascent is the amount by which the character ascends above the baseline.

    ###### Returns

    the ascent in pixels

  - ### getDescent

    public int getDescent()

    The descent is the amount by which the character descends below the baseline

    ###### Returns

    the descent in pixels

  - ### getPixelSize

    public float getPixelSize()

    Returns the size with which the font object was created in case of truetype fonts/derived fonts. This is useful since a platform might change things slightly based on platform constraints but this value should be 100% consistent

    ###### Returns

    the size requested in the derive method