Coder Social home page Coder Social logo

fontman-client's Introduction

fontman-client's People

Contributors

gmisail avatar meowox avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

meowox

fontman-client's Issues

Setup system files if they do not exist

When running fontman, it is assumed that some files & directories exist. As of right now (September 27th) there is one required folder: ~/.fontman. If you run any command, we must first check if this directory exists. If not, create it.

This ticket is simply for the functionality of creating the folder if it does not exist. Something like:

// parse command...

if !config.HasHomeDirectory() {
    config.CreateHomeDirectory()
    // log some details ...
}

// run command

The names likely won't be the same (especially if we support global installations) but the logic is the same.

Add bindings to fc-cache

We should be able to make a call to fc-cache from Go. The only calls that we need to cover are:

fc-cache -v
fc-cache -v -f

The reason we have -v is so that we can parse the output report that back to the user. For instance, we can say something like:

$ fontman cache
Successfully cached 5 fonts, 100 already cached.
$ fontman cache --force
Successfully cached 105 fonts, 0 already cached.

Check if installed before installation

If you're trying to install, say, Arial we would like to check if Arial is installed before our own version. This can be hooked into the InstallFont function; we check if it is installed and if so we abort the operation.

Example

$ fontman install Arial
Font 'Arial' already installed.

Use build constraints for macOS

Instead of checking all paths regardless of operating systems, split the font path logic into different files based on operating system. For instance:

path_darwin.go, path_linux.go

Format font list

$ fontman list
Helvetica (Regular, Italics, Bold)
Iosevka (Regular)
Hasklug (Regular)

Given a list of font families, compactly print them and their styles.

Create temporary folder in `~/.fontman`

When downloading a font, we want to download to a temporary font before actually installing them. To overcome this we could add a tmp folder to the .fontman folder. So, installing fonts from remote boils down to:

  1. Get font details (URL's where fonts are located)
  2. For each font, download to ~/.fontman/tmp
  3. Pass each downloaded font to the InstallFont function

Create default configuration file if it does not exist

Instead of checking for paths on every command invocation, instead make a "default" configuration file with sane defaults, i.e. fontPath will be the "best" or default installation path that we detect. Now when we run a command, we can pull directories & properties directly from the file.

Update folder structure to be more organized

Right now, there's some organization but it could be better. This ticket would basically be for creating a desired plan for what the package structure should look like.

api/             (api controllers)
model/        (reading configuration files, data models)
service/      (business logic, installation)
errors/        (errors)
util/             (utility / helper functions)
test/            (tests)

This standardization ensures that adding functionality is relatively easy. Most importantly, things are predictable, it is easy to tell where things are supposed to go.

Add system for installing local fonts

The process is relatively simple:

  • Given a file, check if it is a supported format (OTF, TTF, TTC, etc...)
  • If it is supported, check if it exists and move it to the fontman font installation directory
  • Regenerate cache

The process should resemble the actual process for installing a font manually.

$ fontman install Inconsolata.ttf
Installed to '~/.fontman/fonts/Inconsolata.ttf' ๐ŸŽ‰

The output isn't final, but we should report back that everything is working as expected.

Create `~/.config/fontman` directory if it does not exist

This directory is where we will store authentication credentials, fontman configuration files, etc... This is different from the ~/.fontman folder; this is purely for configuration details, not font data.

That being said, we will check for it in a similar way; on command invocation, load in the configurations & authentication details. If they don't exist, create them.

Add bindings to fc-list

We should be able to make a call to fc-list and parse the results into a native Go structure.

Find similar font names if name does not exist

Right now the database finds partial matches, i.e. Mono will match with Roboto Mono & Comic Mono. The goal is if a user types a font that does not exist, we can infer what they were trying to say.

An example of this would be if the user runs fontman install "Robto mono". This will not match with anything, however it is clear what they want to install. On the server, we will have to integrate fuzzy searching so that we can infer what the user might be looking for.

Add `.fontman` path to FontConfig

Add the fontman font installation path to FontConfig's configuration file.

<dir>/usr/share/fonts</dir>
<dir>/usr/X11R6/lib/X11/fonts</dir>
<dir>/home/demouser/.fontman</dir>

This will allow fc-* to find & cache fonts installed by fontman.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.