Checks if characters occurs in the given font.
346994
def fontChar(self, font, char):
        
        font_files = self._getCharFont(self._getFont(font), char)
        print('The character is {0}present in this font.'.format('' if font_files else 'not '))
939706
def com_google_fonts_check_currency_chars(ttFont):
  """"""

  def font_has_char(ttFont, codepoint):
    for subtable in ttFont['cmap'].tables:
      if codepoint in subtable.cmap:
        return True
    #otherwise
    return False

  failed = False

  OPTIONAL = {
    #TODO: Do we want to check for this one?
    #0x20A0: "EUROPEAN CURRENCY SIGN"
  }
  MANDATORY = {
    0x20AC: "EURO SIGN"
    # TODO: extend this list
  }
  for codepoint, charname in OPTIONAL.items():
    if not font_has_char(ttFont, codepoint):
      failed = True
      yield WARN, f"Font lacks \"{charname}\" character (unicode: 0x{codepoint:04X})"

  for codepoint, charname in MANDATORY.items():
    if not font_has_char(ttFont, codepoint):
      failed = True
      yield FAIL, f"Font lacks \"{charname}\" character (unicode: 0x{codepoint:04X})"

  if not failed:
    yield PASS, "Font has all expected currency sign characters."
1298294
public static int occurrencesOfChar(String string, final char value)
    {
        return StringIterate.countChar(string, new CharPredicate()
        {
            public boolean accept(char character)
            {
                return value == character;
            }
        });
    }
488377
def com_google_fonts_check_fsselection(ttFont, style):
  """"""
  from fontbakery.utils import check_bit_entry
  from fontbakery.constants import (STATIC_STYLE_NAMES,
                                    RIBBI_STYLE_NAMES,
                                    FsSelection)

  # Checking fsSelection REGULAR bit:
  expected = "Regular" in style or \
             (style in STATIC_STYLE_NAMES and
              style not in RIBBI_STYLE_NAMES and
              "Italic" not in style)
  yield check_bit_entry(ttFont, "OS/2", "fsSelection",
                        expected,
                        bitmask=FsSelection.REGULAR,
                        bitname="REGULAR")

  # Checking fsSelection ITALIC bit:
  expected = "Italic" in style
  yield check_bit_entry(ttFont, "OS/2", "fsSelection",
                        expected,
                        bitmask=FsSelection.ITALIC,
                        bitname="ITALIC")

  # Checking fsSelection BOLD bit:
  expected = style in ["Bold", "BoldItalic"]
  yield check_bit_entry(ttFont, "OS/2", "fsSelection",
                        expected,
                        bitmask=FsSelection.BOLD,
                        bitname="BOLD")
120311
public static PDFont chooseMatchingHelvetica(Font font) {
		if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
			return PDType1Font.HELVETICA_BOLD_OBLIQUE;
		if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
			return PDType1Font.HELVETICA_OBLIQUE;
		if ((font.getStyle() & Font.BOLD) == Font.BOLD)
			return PDType1Font.HELVETICA_BOLD;
		return PDType1Font.HELVETICA;
	}
919593
private boolean checkText(final Characters paramEvent) {
        assert paramEvent != null;
        final String text = paramEvent.getData().trim();
        return mWtx.getNode().getKind() == IConstants.TEXT && mWtx.getValueOfCurrentNode().equals(text);
    }
54394
def check(text):
    """"""
    err = "misc.suddenly"
    msg = u"Suddenly is nondescript, slows the action, and warns your reader."
    regex = "Suddenly,"

    return existence_check(text, [regex], err, msg, max_errors=3,
                           require_padding=False, offset=-1, ignore_case=False)
1090855
def check_ellipsis(text):
    """"""
    err = "typography.symbols.ellipsis"
    msg = u"'...' is an approximation, use the ellipsis symbol '…'."
    regex = "\.\.\."

    return existence_check(text, [regex], err, msg, max_errors=3,
                           require_padding=False, offset=0)
280761
public static boolean iconExists(@NonNull Context context, @NonNull String icon) {
        try {
            ITypeface font = findFont(context, icon.substring(0, 3));
            icon = icon.replace("-", "_");
            font.getIcon(icon);
            return true;
        } catch (Exception ignore) {
            return false;
        }
    }
136332
function containsCharacter(string, char1, fromIndex, stopCharacterTable) {
  var len = string.length;
  for (var i = fromIndex; i < len; ++i) {
    var ch = string.charCodeAt(i);

    if (ch === char1) {
      return true;
    }
    else if (stopCharacterTable[ch] === 1) {
      return false;
    }
  }
  return false;
}
1100557
def check_multiplication_symbol(text):
    """
    err = "typography.symbols.multiplication_symbol"
    msg = u"Use the multiplication symbol ×, not the letter x."
    regex = "[0-9]+ ?x ?[0-9]+"

    return existence_check(
        text, [regex], err, msg, max_errors=3, require_padding=False)
1111907
public int match(FontSpec font)
    {
        if (this.family.equalsIgnoreCase(font.family))
        {
            int ret = 100;
            
            if (this.weight == null)
                ret++;
            else if  (representsBold(this.weight) == representsBold(font.weight))
                ret += 10;
            
            if (this.style == null)
                ret++;
            else if (this.style == font.style)
                ret += 10;
            
            return ret;
        }
        else
            return 0;
    }
876359
def invalid_characters(self, text):
        """"""
        return ''.join(sorted(set([c for c in text if c not in self.alphabet])))
586393
private static boolean isCollationCorrect(String collation) {
    return containsIgnoreCase(collation, CASE_SENSITIVE_ACCENT_SENSITIVE)
      || containsIgnoreCase(collation, BIN)
      || containsIgnoreCase(collation, BIN2);
  }
834201
private static boolean containsSpecialCharacter(String value) {
        for (int x = 0; x < value.length(); x++) {
            char c = value.charAt(x);
            if (c == '?' || c == '*') {
                return true;
            } else if (c == '\\') {
                //skip the next character because it is quoted
                x += 1;
            }
        }
        return false;
    }
145144
private String utfIncludeCheck(String line, Boolean addatsign)
	{
		String checked = "";
		boolean start = false;

		for (int i = 0; i < line.length(); i++)
		{
			if (isOneByte(line.substring(i, i + 1)))
			{
				if (start)
				{
					start = false;
					checked += (addatsign ? useJPNFont ? fontEnd
							+ LST_ESCAPE_END : "" : fontEnd)
							+ line.substring(i, i + 1);
				} else
				{
					checked += line.substring(i, i + 1);
				}
			} else
			{
				if (!start)
				{
					checked += (addatsign ? useJPNFont ? LST_ESCAPE_BEGIN : ""
							: "")
							+ (useJPNFont ? docFont : "")
							+ line.substring(i, i + 1);
					start = true;
				} else
				{
					checked += line.substring(i, i + 1);
				}
			}
		}
		if (start)
		{
			checked += addatsign ? useJPNFont ? fontEnd + LST_ESCAPE_END : ""
					: fontEnd;
		}
		return checked;
	}
465785
def check_trademark_symbol(text):
    """"""
    err = "typography.symbols.trademark"
    msg = u"(TM) is a goofy alphabetic approximation, use the symbol ™."
    regex = "\(TM\)"

    return existence_check(
        text, [regex], err, msg, max_errors=3, require_padding=False)