def resolve_font(name):
    """Turns font names into absolute filenames

    This is case sensitive. The extension should be omitted.

    For example::

        >>> path = resolve_font('NotoSans-Bold')

        >>> fontdir = os.path.join(os.path.dirname(__file__), 'fonts')
        >>> noto_path = os.path.join(fontdir, 'NotoSans-Bold.ttf')
        >>> noto_path = os.path.abspath(noto_path)
        >>> assert path == noto_path

    Absolute paths are allowed::

        >>> resolve_font(noto_path) == noto_path
        True

    Raises :exc:`FontNotFound` on failure::

        >>> try:
        ...     resolve_font('blahahaha')
        ...     assert False
        ... except FontNotFound:
        ...     pass

    """
    if os.path.exists(name):
        return os.path.abspath(name)
    fonts = get_font_files()
    if name in fonts:
        return fonts[name]
    raise FontNotFound("Can't find %r :'(  Try adding it to ~/.fonts" % name)