MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / sizeFont

Method sizeFont

CodenameOne/src/com/codename1/ui/FontImage.java:7715–7726  ·  view source on GitHub ↗
(Font fnt, int w, int padding)

Source from the content-addressed store, hash-verified

7713 }
7714
7715 private static Font sizeFont(Font fnt, int w, int padding) {
7716 if (!Font.isTrueTypeFileSupported()) {
7717 return Font.getDefaultFont();
7718 }
7719 int paddingPixels = Display.getInstance().convertToPixels(padding, true);
7720 w -= paddingPixels;
7721 int h = fnt.getHeight();
7722 if (h != w) {
7723 return fnt.derive(w, Font.STYLE_PLAIN);
7724 }
7725 return fnt;
7726 }
7727
7728 /// Throws a runtime exception
7729 @Override

Callers 3

createFixedMethod · 0.95
drawImageMethod · 0.95
setPaddingMethod · 0.95

Calls 6

getDefaultFontMethod · 0.95
getInstanceMethod · 0.95
convertToPixelsMethod · 0.65
getHeightMethod · 0.65
deriveMethod · 0.45

Tested by

no test coverage detected