Get the path of font project directory.
550105
def family_directory(fonts):
  """"""
  if fonts:
    dirname = os.path.dirname(fonts[0])
    if dirname == '':
      dirname = '.'
    return dirname
1172803
def get_project_config_path(path=None):
    """"""
    project_path = Path(path or '.').absolute().joinpath(RENKU_HOME)
    if project_path.exists() and project_path.is_dir():
        return str(project_path)
730838
def get_path(self, dir=None):
        """"""
        if not dir:
            dir = self.fs.getcwd()
        if self == dir:
            return '.'
        path_elems = self.get_path_elements()
        pathname = ''
        try: i = path_elems.index(dir)
        except ValueError:
            for p in path_elems[:-1]:
                pathname += p.dirname
        else:
            for p in path_elems[i+1:-1]:
                pathname += p.dirname
        return pathname + path_elems[-1].name
764745
def get_html_theme_path():
    """"""
    theme_path = os.path.abspath(os.path.dirname(__file__))
    return [theme_path]
187608
def application_path(path):
    
    from uliweb import application
    return os.path.join(application.project_dir, path)
1303594
def find_font(font_name):
    """"""
    if font_name in STANDARD_FONT_NAMES:
        return font_name, True
    elif font_name in _registered_fonts:
        return font_name, _registered_fonts[font_name]

    NOT_FOUND = (None, False)
    try:
        # Try first to register the font if it exists as ttf,
        # based on ReportLab font search.
        registerFont(TTFont(font_name, '%s.ttf' % font_name))
        _registered_fonts[font_name] = True
        return font_name, True
    except TTFError:
        # Try searching with Fontconfig
        try:
            pipe = subprocess.Popen(
                ['fc-match', '-s', '--format=%{file}\\n', font_name],
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
            )
            output = pipe.communicate()[0].decode(sys.getfilesystemencoding())
            font_path = output.split('\n')[0]
        except OSError:
            return NOT_FOUND
        try:
            registerFont(TTFont(font_name, font_path))
        except TTFError:
            return NOT_FOUND
        # Fontconfig may return a default font totally unrelated with font_name
        exact = font_name.lower() in os.path.basename(font_path).lower()
        _registered_fonts[font_name] = exact
        return font_name, exact
777043
def sink_path(cls, project, sink):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/sinks/{sink}", project=project, sink=sink
        )
292598
def tile_fonts(self, fontstack, stack_range, out_folder=None):
        """"""
        url = "{url}/resources/fonts/{fontstack}/{stack_range}.pbf".format(
            url=self._url,
            fontstack=fontstack,
            stack_range=stack_range)
        params = {}
        if out_folder is None:
            out_folder = tempfile.gettempdir()
        return self._get(url=url,
                         param_dict=params,
                         out_folder=out_folder,
                         securityHandler=self._securityHandler,
                         proxy_port=self._proxy_port,
                         proxy_url=self._proxy_host)
272828
def get_themes_directory(theme_name=None, png=False):
    """"""
    dir_themes = os.path.join(get_file_directory(), "themes")
    if theme_name is None:
        return dir_themes
    if theme_name in os.listdir(dir_themes):
        return dir_themes
    dir = "png" if png is True else "gif"
    return os.path.join(get_file_directory(), dir)
1163500
def find_project_dir(path=os.getcwd()):
    """"""
    path_split = os.path.split(path)
    while path_split[1]:
        if in_armstrong_project(path):
            return path
        path = path_split[0]
        path_split = os.path.split(path)
    # we ran out of parents
    return None
358761
def com_google_fonts_check_repo_dirname_match_nameid_1(fonts,
                                                       gfonts_repo_structure):
  """"""
  from fontTools.ttLib import TTFont
  from fontbakery.utils import (get_name_entry_strings,
                                get_absolute_path,
                                get_regular)
  regular = get_regular(fonts)
  if not regular:
    yield FAIL, "The font seems to lack a regular."

  entry = get_name_entry_strings(TTFont(regular), NameID.FONT_FAMILY_NAME)[0]
  expected = entry.lower()
  expected = "".join(expected.split(' '))
  expected = "".join(expected.split('-'))

  license, familypath, filename = get_absolute_path(regular).split(os.path.sep)[-3:]
  if familypath == expected:
    yield PASS, "OK"
  else:
    yield FAIL, (f"Family name on the name table ('{entry}') does not match"
                 f" directory name in the repo structure ('{familypath}')."
                 f" Expected '{expected}'.")
755772
def determine_path():
    """"""
    root = __file__
    if os.path.islink(root):
        root = os.path.realpath(root)
    return os.path.dirname(os.path.abspath(root))
831102
def set_font_path(self, path, onerror = None):
        """"""
        request.SetFontPath(display = self.display,
                            onerror = onerror,
                            path = path)
432177
def browse_path(self, window):
        
        text = self.gui_helper.create_file_chooser_dialog("Choose project directory", self.path_window, name="Select")
        if text is not None:
            self.dir_name.set_text(text)
28983
def _get_path(name, settings, mkdir=True):
    
    default_projects_path = settings.config.get("projects_path")
    path = None

    if default_projects_path:
        path = raw_input("\nWhere would you like to create this project? [{0}/{1}] ".format(default_projects_path, name))
        if not path:
            path = os.path.join(default_projects_path, name)
    else:
        while not path:
            path = raw_input("\nWhere would you like to create this project? (e.g. ~/tarbell/) ")

    return os.path.expanduser(path)
529183
def _get_gs_path():
    """"""
    path = os.environ.get("PATH", os.defpath)

    for dir in path.split(os.pathsep):
        for name in ("gs", "gs.exe", "gswin32c.exe"):
            g = os.path.join(dir, name)
            if os.path.exists(g):
                return g
    raise Exception("Ghostscript not found. path=%s" % str(path))
525292
private function _ide_path(){
    if ( !self::$dev_path ){
      $this->_set_appui();
      if ( $id = $this->options->from_code(self::IDE_PATH, BBN_APPUI) ){
        self::set_ide_path($id);
      }
    }
    return self::$ide_path;
  }