• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Font类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中playn.core.Font的典型用法代码示例。如果您正苦于以下问题:Java Font类的具体用法?Java Font怎么用?Java Font使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Font类属于playn.core包,在下文中一共展示了Font类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import playn.core.Font; //导入依赖的package包/类
@Override
public void main(){
  Typeface face = platform().assets().getTypeface("text/Museo.otf");
  platform().graphics().registerFont(face, "Museo-300", Font.Style.PLAIN);
  platform().graphics().registerFont(face, "Museo-300", Font.Style.BOLD);
  platform().graphics().registerFont(face, "Museo-300", Font.Style.ITALIC);
  platform().graphics().registerFont(face, "Museo-300", Font.Style.BOLD_ITALIC);
  _game = new Showcase(platform(), new Showcase.DeviceService() {
    public String info() {
      Runtime rt = Runtime.getRuntime();
      ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
      return ("Android [model=" + Build.MODEL + ", cpu=" + Build.CPU_ABI +
              ", osver=" + Build.VERSION.RELEASE + ", mclass=" + am.getMemoryClass() +
              ", mem=" + (rt.freeMemory()/1024) + "k/" + (rt.totalMemory()/1024) + "k" +
              ", maxmem=" + (rt.maxMemory()/1024) + "k]");
    }
  });
}
 
开发者ID:playn,项目名称:playn-samples,代码行数:19,代码来源:ShowcaseActivity.java


示例2: createControlsAndBioGroup

import playn.core.Font; //导入依赖的package包/类
private Group createControlsAndBioGroup(Root root) {
    final EmployeeProfile profile = gameWorld.profile.get(id);
    final float borderThickness = percentOfViewHeight(0.005f);
    Group employeeDataGroup = new Group(AxisLayout.vertical().offStretch());
    for (EmployeeProfile.Credential credential : profile.credentials) {
        employeeDataGroup.add(wrappingLabel(credential.name + " (" + credential.provider + ")"));
    }
    employeeDataGroup.add(wrappingLabel(profile.bio))
            .addStyles(Style.BACKGROUND.is(
                    Background.bordered(Palette.DIALOG_BACKGROUND, Palette.DIALOG_BORDER, borderThickness)
                            .inset(borderThickness * 2)));
    final float spaceAroundNameAndTaskArea = percentOfViewHeight(0.03f);
    final Font nameFont = FontCache.instance().REGULAR.derive(percentOfViewHeight(0.03f));
    return new Group(AxisLayout.vertical())
            .add(new Shim(0, spaceAroundNameAndTaskArea),
                    dialogStyledLabel(profile.firstName + " " + profile.lastName)
                            .addStyles(Style.FONT.is(nameFont),
                                    Style.COLOR.is(Palette.NAME_COLOR)),
                    createSkillSummaryGroup(),
                    new TaskSelector(root, gameWorld.entity(id)),
                    new Shim(0, spaceAroundNameAndTaskArea),
                    employeeDataGroup,
                    new Shim(0, 0).setConstraint(AxisLayout.stretched()))
            .setConstraint(AxisLayout.stretched(CONTROLS_AREA_WEIGHT));
}
 
开发者ID:social-startup-game,项目名称:social-startup-game,代码行数:26,代码来源:MainUIGroup.java


示例3: main

import playn.core.Font; //导入依赖的package包/类
@Override public void main () {
  // register our fonts
  Typeface copperplate = platform().assets().getTypeface("fonts/copperplate.ttf");
  platform().graphics().registerFont(copperplate, "Copperplate", Font.Style.PLAIN);
  platform().graphics().registerFont(copperplate, "Copperplate", Font.Style.BOLD);

  // use a lower-memory format for JPGs (which tend to be large and memory sucking)
  platform().assets().setBitmapOptionsAdjuster(new AndroidAssets.BitmapOptionsAdjuster() {
    @Override public void adjustOptions (String path, AndroidAssets.BitmapOptions options) {
      // use a 16-bit per pixel format for JPGs; looks decent, saves memory
      if (path.endsWith(".jpg")) options.inPreferredConfig = Bitmap.Config.RGB_565;
    }
  });

  game = new Pokeros(platform(), 0.5f);
}
 
开发者ID:samskivert,项目名称:mashups,代码行数:17,代码来源:PokerosActivity.java


示例4: resolveFont

import playn.core.Font; //导入依赖的package包/类
/**
 * Resolves the CTFont for the PlayN {@code font}. {@code font} may be {@code null}, in which
 * case the default font is returned.
 */
static CTFont resolveFont (Font font) {
  CTFont ctFont = fonts.get(font == null ? DEFAULT_FONT : font);
  if (ctFont == null) {
    String iosName = getVariant(font.name, font.style);
    fonts.put(font, ctFont = CTFont.create(iosName, font.size, CGAffineTransform.Identity()));
  }
  return ctFont;
}
 
开发者ID:playn,项目名称:playn,代码行数:13,代码来源:RoboFont.java


示例5: toCSS

import playn.core.Font; //导入依赖的package包/类
public static String toCSS (Font font) {
  String name = font.name;
  if (!name.startsWith("\"") && name.contains(" ")) name = '"' + name + '"';

  String style = "";
  switch (font.style) {
  case BOLD:        style = "bold";   break;
  case ITALIC:      style = "italic"; break;
  case BOLD_ITALIC: style = "bold italic"; break;
  default: break; // nada
  }

  return style + " " + font.size + "px " + name;
}
 
开发者ID:playn,项目名称:playn,代码行数:15,代码来源:HtmlFont.java


示例6: create

import playn.core.Font; //导入依赖的package包/类
public static Typeface create (Font font) {
  return Typeface.create(font.name, TO_ANDROID_STYLE.get(font.style));
}
 
开发者ID:playn,项目名称:playn,代码行数:4,代码来源:AndroidFont.java


示例7: configContext

import playn.core.Font; //导入依赖的package包/类
static void configContext(Context2d ctx, TextFormat format) {
  Font font = getFont(format);
  ctx.setFont(HtmlFont.toCSS(font));
  ctx.setTextBaseline(Context2d.TextBaseline.TOP);
}
 
开发者ID:playn,项目名称:playn,代码行数:6,代码来源:HtmlTextLayout.java


示例8: getFont

import playn.core.Font; //导入依赖的package包/类
static Font getFont(TextFormat format) {
  return (format.font == null) ? HtmlFont.DEFAULT : format.font;
}
 
开发者ID:playn,项目名称:playn,代码行数:4,代码来源:HtmlTextLayout.java


示例9: HtmlFontMetrics

import playn.core.Font; //导入依赖的package包/类
public HtmlFontMetrics(Font font, float height, float emwidth) {
  this.font = font;
  this.height = height;
  this.emwidth = emwidth;
}
 
开发者ID:playn,项目名称:playn,代码行数:6,代码来源:HtmlFontMetrics.java


示例10: newSheetBuilder

import playn.core.Font; //导入依赖的package包/类
/**
 * Creates and returns a stylesheet builder configured with some useful default styles. The
 * caller can augment the sheet with additional styles and call {@code create}.
 */
public static Stylesheet.Builder newSheetBuilder(Graphics gfx) {
    final Font font = FontCache.instance().REGULAR;
    int bgColor = 0xFFCCCCCC, ulColor = UL_COLOR, brColor = 0xFFAAAAAA;
    Background butBg = Background.roundRect(gfx, bgColor, 5, ulColor, 2).inset(5, 6, 2, 6);
    Background butSelBg = Background.roundRect(gfx, bgColor, 5, brColor, 2).inset(6, 5, 1, 7);
    Background disabledChangeViewButtonBackground = Background.roundRect(gfx, Palette.DIALOG_BACKGROUND, 5, ulColor, 2)
            .inset(5, 6, 2, 6);
    return Stylesheet.builder()
            .add(Button.class,
                    Style.BACKGROUND.is(butBg),
                    Style.FONT.is(font))
            .add(Button.class, Style.Mode.SELECTED,
                    Style.BACKGROUND.is(butSelBg))
            .add(Button.class,
                    Style.ACTION_SOUND.is(SfxCache.instance().CLICK))
            .add(ToggleButton.class,
                    Style.BACKGROUND.is(butBg))
            .add(ToggleButton.class, Style.Mode.SELECTED,
                    Style.BACKGROUND.is(butSelBg))
            .add(CheckBox.class,
                    Style.BACKGROUND.is(Background.roundRect(gfx, bgColor, 5, ulColor, 2).
                            inset(3, 2, 0, 3)))
            .add(CheckBox.class, Style.Mode.SELECTED,
                    Style.BACKGROUND.is(Background.roundRect(gfx, bgColor, 5, brColor, 2).
                            inset(3, 2, 0, 3)))
            // flip ul and br to make Field appear recessed
            .add(Field.class,
                    Style.BACKGROUND.is(Background.beveled(0xFFFFFFFF, brColor, ulColor).inset(5)),
                    Style.HALIGN.left)
            .add(Field.class, Style.Mode.DISABLED,
                    Style.BACKGROUND.is(Background.beveled(0xFFCCCCCC, brColor, ulColor).inset(5)))
            .add(Menu.class,
                    Style.BACKGROUND.is(Background.bordered(0xFFFFFFFF, 0x00000000, 1).inset(6)))
            .add(MenuItem.class,
                    Style.BACKGROUND.is(Background.solid(0xFFFFFFFF)),
                    Style.HALIGN.left,
                    Style.FONT.is(font))
            .add(MenuItem.class, Style.Mode.SELECTED,
                    Style.BACKGROUND.is(Background.solid(0xFF000000)),
                    Style.COLOR.is(0xFFFFFFFF))
            .add(Tabs.class,
                    Tabs.HIGHLIGHTER.is(Tabs.textColorHighlighter(0xFF000000, 0xFFFFFFFF)))
            .add(Label.class,
                    Style.FONT.is(font))
            .add(GameInteractionArea.ChangeViewControl.ChangeViewButton.class,
                    Style.BACKGROUND.is(butBg),
                    Style.FONT.is(font))
            .add(GameInteractionArea.ChangeViewControl.ChangeViewButton.class, Style.Mode.SELECTED,
                    Style.BACKGROUND.is(butSelBg))
            .add(GameInteractionArea.ChangeViewControl.ChangeViewButton.class, Style.Mode.DISABLED,
                    Style.BACKGROUND.is(disabledChangeViewButtonBackground))
            .add(GameInteractionArea.ChangeViewControl.ChangeViewButton.class,
                    Style.TEXT_EFFECT.pixelOutline)
            .add(GameInteractionArea.ChangeViewControl.ChangeViewButton.class,
                    Style.HIGHLIGHT.is(Palette.UNUSED_SPACE))
            .add(GameInteractionArea.ChangeViewControl.ChangeViewButton.class,
                    Style.COLOR.is(Palette.FOREGROUND))
            .add(GameInteractionArea.ChangeViewControl.ChangeViewButton.class,
                    Style.ACTION_SOUND.is(SfxCache.instance().CLICK))
            .add(GameInteractionArea.ChangeViewControl.CountLabel.class,
                    Style.FONT.is(font.derive(font.size * 0.85f)),
                    Style.COLOR.is(GameColors.WHITE),
                    Style.TEXT_EFFECT.pixelOutline,
                    Style.HIGHLIGHT.is(GameColors.HUNTER_GREEN));

}
 
开发者ID:social-startup-game,项目名称:social-startup-game,代码行数:71,代码来源:SimGameStyle.java


示例11: makeFont

import playn.core.Font; //导入依赖的package包/类
private Font makeFont(String name, float percentOfHeight) {
    return new Font(name, viewSize.percent(percentOfHeight));
}
 
开发者ID:social-startup-game,项目名称:social-startup-game,代码行数:4,代码来源:FontCache.java


示例12: PlaynNuitFont

import playn.core.Font; //导入依赖的package包/类
public PlaynNuitFont(String name, Font.Style style, float size, boolean antialiasing) {
    font = PlayN.graphics().createFont(name, style, size);
    format = new TextFormat(font, antialiasing);
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:5,代码来源:PlaynNuitFont.java



注:本文中的playn.core.Font类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LdapUtils类代码示例发布时间:2022-05-23
下一篇:
Java CraftItem类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap