@Test public void testFontFunctions() throws Exception { FontCache fc = FontCache.getDefaultInstance(); fc.registerFont(loadFont("DroidSansArmenian.ttf")); fc.registerFont(loadFont("DroidSansFallback.ttf")); fc.registerFont(loadFont("DroidNaskh-Regular.ttf")); Function alternatives = ff.function("fontAlternatives", ff.literal("Droid")); assertThat( (List<String>) alternatives.evaluate(null, List.class), hasItems("Droid Arabic Naskh", "Droid Sans Armenian", "Droid Sans Fallback")); Literal regularFont = ff.literal("Droid Sans Regular"); Literal boldItalic = ff.literal("Droid Sans Italic Bold"); assertThat(ff.function("mbFontStyle", regularFont).evaluate(null), equalTo("normal")); assertThat(ff.function("mbFontStyle", boldItalic).evaluate(null), equalTo("italic")); assertThat(ff.function("mbFontWeight", regularFont).evaluate(null), equalTo("normal")); assertThat(ff.function("mbFontWeight", boldItalic).evaluate(null), equalTo("bold")); }
@Override public Function function(String name, List<Expression> args, Literal fallback) { return function(new NameImpl(name), args, fallback); }
MBFunctionFactory implements FunctionFactory { @Override public Function function(String name, List<Expression> args, Literal fallback) { return function(new NameImpl(name), args, fallback); } }
MBFunctionFactory implements FunctionFactory { @Override public Function function(String name, List<Expression> args, Literal fallback) { return function(new NameImpl(name), args, fallback); }  }
MBFunctionFactory implements FunctionFactory { @Override public Function function(String name, List<Expression> args, Literal fallback) { return function(new NameImpl(name), args, fallback); }  @Override List<FunctionName> getFunctionNames(); @Override Function function(String name, List<Expression> args, Literal fallback); @Override Function function(Name name, List<Expression> args, Literal fallback); }
MBFunctionFactory implements FunctionFactory { @Override public Function function(String name, List<Expression> args, Literal fallback) { return function(new NameImpl(name), args, fallback); }  @Override List<FunctionName> getFunctionNames(); @Override Function function(String name, List<Expression> args, Literal fallback); @Override Function function(Name name, List<Expression> args, Literal fallback);  }