Пример #1
0
  public String getFontFromTheme(STTheme type) {

    TextFont textFont = getTextFontFromTheme(type);
    if (textFont == null) {

      log.warn("No font specified for " + type.toString());
      return null;

    } else {
      String typeface = textFont.getTypeface();
      if (typeface == null) {
        log.warn("Missing typeface in font for " + type.toString());
        return null;
      } else {
        return typeface;
      }
    }
  }
Пример #2
0
  public String getFont(STTheme type, CTLanguage themeFontLang) {

    log.debug(type.toString());

    if (themeFontLang == null) {
      // then the default fonts for each region as specified by the latin, ea, and cs elements
      // should be used
      log.debug("themeFontLang==null");
      return getFontFromTheme(type);

    } else {

      String lang = this.getLang(themeFontLang, type);
      if (lang == null) {
        log.debug("lang==null");
        return getFontFromTheme(type);
      }
      log.debug(lang);

      //    		Throwable t = new Throwable();
      //    		t.printStackTrace();

      // need to convert
      String script = LanguageTagToScriptMapping.getScriptForLanguageTag(lang);

      if (script == null) {
        return getFontFromTheme(type);
      } else {

        // now, lookup @typeface in the map
        String typeface = null;
        if (isMajor(type)) {
          typeface = getScriptToTypefaceMajor().get(script);
        } else {
          typeface = getScriptToTypefaceMinor().get(script);
        }

        if (typeface == null) {
          return getFontFromTheme(type);
        } else {
          return typeface;
        }
      }
    }
  }