Beispiel #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;
      }
    }
  }
Beispiel #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;
        }
      }
    }
  }
Beispiel #3
0
  private TextFont getTextFontFromTheme(STTheme type) {

    if (type.equals(STTheme.MAJOR_EAST_ASIA)) {
      return getMajorEastAsian();
    } else if (type.equals(STTheme.MINOR_EAST_ASIA)) {
      return getMinorEastAsian();

    } else if (type.equals(STTheme.MAJOR_ASCII)) {
      return getMajorLatin();
    } else if (type.equals(STTheme.MINOR_ASCII)) {
      return getMinorLatin();

    } else if (type.equals(STTheme.MAJOR_BIDI)) {
      return getMajorComplexScript();
    } else if (type.equals(STTheme.MINOR_BIDI)) {
      return getMinorComplexScript();

    } else if (type.equals(STTheme.MAJOR_H_ANSI)) {
      return getMajorHighAnsi();
    } else if (type.equals(STTheme.MINOR_H_ANSI)) {
      return getMinorHighAnsi();
    }
    return getMinorLatin();
  }