Skip to content

Commit

Permalink
project cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Sep 29, 2019
1 parent d73eb82 commit e4b4966
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![Build Status](https://travis-ci.org/devongovett/font-manager.svg)](https://travis-ci.org/devongovett/font-manager)
# font-manager (redux)

![Travis (.org)](https://img.shields.io/travis/eugeny/fontmanager-redux?label=Mac%2FLINUX&style=for-the-badge) ![AppVeyor](https://img.shields.io/appveyor/ci/eugeny/fontmanager-redux?label=windows&style=for-the-badge)

# font-manager

A C++ module for Node.js providing access to the system font catalog.

Expand All @@ -20,7 +21,7 @@ A C++ module for Node.js providing access to the system font catalog.

Installation of the `font-manager` module is via npm:

npm install font-manager
npm install font-manager-redux

On Linux, you also may need to install the `libfontconfig-dev` package, for example:

Expand All @@ -31,7 +32,7 @@ On Linux, you also may need to install the `libfontconfig-dev` package, for exam
You load the `font-manager` module using `require` as with all Node modules:

```javascript
var fontManager = require('font-manager');
import * as fontManager from 'font-manager-redux';
```

All of the methods exported by `font-manager` have both synchronous and asynchronous versions available.
Expand All @@ -53,7 +54,7 @@ Returns an array of all [font descriptors](#font-descriptor) available on the sy
fontManager.getAvailableFonts(function(fonts) { ... });

// synchronous API
var fonts = fontManager.getAvailableFontsSync();
const fonts = fontManager.getAvailableFontsSync();

// output
[ { path: '/Library/Fonts/Arial.ttf',
Expand All @@ -69,16 +70,16 @@ var fonts = fontManager.getAvailableFontsSync();

### findFonts(fontDescriptor)

Returns an array of [font descriptors](#font-descriptor) matching a query
[font descriptor](#font-descriptor).
Returns an array of [font descriptors](#font-descriptor) matching a query
[font descriptor](#font-descriptor).
The returned array may be empty if no fonts match the font descriptor.

```javascript
// asynchronous API
fontManager.findFonts({ family: 'Arial' }, function(fonts) { ... });

// synchronous API
var fonts = fontManager.findFontsSync({ family: 'Arial' });
const fonts = fontManager.findFontsSync({ family: 'Arial' });

// output
[ { path: '/Library/Fonts/Arial.ttf',
Expand All @@ -103,7 +104,7 @@ var fonts = fontManager.findFontsSync({ family: 'Arial' });

Returns a single [font descriptors](#font-descriptor) matching a query
[font descriptors](#font-descriptor) as well as possible. This method
always returns a result (never `null`), so sometimes the output will not
always returns a result (never `null`), so sometimes the output will not
exactly match the input font descriptor if not all input parameters
could be met.

Expand All @@ -112,7 +113,7 @@ could be met.
fontManager.findFont({ family: 'Arial', weight: 700 }, function(font) { ... });

// synchronous API
var font = fontManager.findFontSync({ family: 'Arial', weight: 700 });
const font = fontManager.findFontSync({ family: 'Arial', weight: 700 });

// output
{ path: '/Library/Fonts/Arial Bold.ttf',
Expand All @@ -139,7 +140,7 @@ in `text`, it is not replaced and the font descriptor for the original font is r
fontManager.substituteFont('TimesNewRomanPSMT', '汉字', function(font) { ... });

// synchronous API
var font = fontManager.substituteFontSync('TimesNewRomanPSMT', '汉字');
const font = fontManager.substituteFontSync('TimesNewRomanPSMT', '汉字');

// output
{ path: '/Library/Fonts/Songti.ttc',
Expand All @@ -156,7 +157,7 @@ var font = fontManager.substituteFontSync('TimesNewRomanPSMT', '汉字');

Font descriptors are normal JavaScript objects that describe characteristics of
a font. They are passed to the `findFonts` and `findFont` methods and returned by
all of the methods. Any combination of the fields documented below can be used to
all of the methods. Any combination of the fields documented below can be used to
find fonts, but all methods return full font descriptors.

Name | Type | Description
Expand Down
5 changes: 0 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
os: Windows Server 2012
environment:
VisualStudioVersion: 11.0
matrix:
- nodejs_version: "6"
- nodejs_version: "8"
Expand All @@ -16,6 +14,3 @@ test_script:
- npm --version
- ps: "npm test # PowerShell" # Pass comment to PS for easier debugging
- cmd: npm test

build: off
version: "{build}"
12 changes: 6 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare module 'font-manager' {
declare module 'font-manager-redux' {
export interface FontDescriptor {
readonly path: string;
readonly style: string;
Expand All @@ -23,7 +23,7 @@ declare module 'font-manager' {

/**
* Fetches fonts in the system
*
*
* @example
* getAvailableFontsSync();
* @returns All fonts descriptors available
Expand All @@ -32,7 +32,7 @@ declare module 'font-manager' {

/**
* Returns trough a callback all fonts descriptors available on the system
*
*
* @param callback Contains the font data
* @example
* getAvailableFonts((fonts) => { ... });
Expand All @@ -52,7 +52,7 @@ declare module 'font-manager' {

/**
* Queries all the fonts in the system matching the given parameters
*
*
* @param fontDescriptor Query parameters
* @param callback Contains the font data
* @example
Expand All @@ -65,7 +65,7 @@ declare module 'font-manager' {
* Find only one font matching the given query. This function always returns
* a result (never null), so sometimes the output will not exactly match the
* input font descriptor if not all input parameters could be met
*
*
* @param fontDescriptor Query parameters
* @example
* findFontSync({ family: 'Arial', weight: 700 });
Expand Down Expand Up @@ -95,7 +95,7 @@ declare module 'font-manager' {
* characteristics (bold, italic, etc) are used to find a suitable
* replacement. If the font already contains the characters in text, it is
* not replaced and the font descriptor for the original font is returned
*
*
* @param postscriptName Name of the font to be replaced
* @param text Characters for matching
* @returns Only one font description matching the function description
Expand Down

0 comments on commit e4b4966

Please sign in to comment.