gmisail / fontman-client Goto Github PK
View Code? Open in Web Editor NEWFont package manager.
License: MIT License
Font package manager.
License: MIT License
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.
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.
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.
$ fontman install Arial
Font 'Arial' already installed.
Currently this is hardcoded in the installer file.
Ideally we include it in the config.yml like registry: [ 'registry.fontman.io', '...' ]
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
For testing if everything works under Ubuntu as well as our native platforms.
$ fontman list
Helvetica (Regular, Italics, Bold)
Iosevka (Regular)
Hasklug (Regular)
Given a list of font families, compactly print them and their styles.
Function that returns true
if the command is being run with sudo
, i.e. sudo fontman install ...
, false otherwise.
Error messages, install
output, uninstall
output, etc...
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:
~/.fontman/tmp
InstallFont
functionInstead 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.
If a configuration file does not exist on startup, create one with sane defaults.
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.
This ticket is composed of two parts:
fontman.yml
files into the Go representationTo achieve this we can one of the many YAML parsers, like this.
We should pipe the output of fc-cache
into Go and then parse the result into something useful.
The process is relatively simple:
fontman
font installation directoryThe 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.
This can be done manually or by something like goreleaser
.
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.
We should be able to make a call to fc-list
and parse the results into a native Go structure.
While fc-cache
is running, pipe this line-based output to the parser for formatting.
The stubs should parse the flags associated with them in the design document, but don't need to have any implementation details. They should be integrated with the root App
so that we can call them with task run -- <command>
.
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 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
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.