GithubHelp home page GithubHelp logo

foliojs / font-manager Goto Github PK

View Code? Open in Web Editor NEW
291.0 17.0 98.0 85 KB

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

License: MIT License

C++ 51.19% JavaScript 33.56% Python 1.24% Shell 0.58% Objective-C++ 13.43%

font-manager's Introduction

Build Status

font-manager

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

Features

  • List all available fonts
  • Find fonts with specified characteristics
  • Font substitution when characters are missing

Platforms

Installation

Installation of the font-manager module is via npm:

npm install font-manager

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

sudo apt-get install libfontconfig-dev

API

You load the font-manager module using require as with all Node modules:

var fontManager = require('font-manager');

All of the methods exported by font-manager have both synchronous and asynchronous versions available. You should generally prefer the asynchronous version as it will allow your program to continue doing other processing while a request for fonts is processing in the background, which may be expensive depending on the platform APIs that are available.

getAvailableFonts()

Returns an array of all font descriptors available on the system.

// asynchronous API
fontManager.getAvailableFonts(function(fonts) { ... });

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

// output
[ { path: '/Library/Fonts/Arial.ttf',
    postscriptName: 'ArialMT',
    family: 'Arial',
    style: 'Regular',
    weight: 400,
    width: 5,
    italic: false,
    monospace: false },
  ... ]

findFonts(fontDescriptor)

Returns an array of font descriptors matching a query font descriptor. The returned array may be empty if no fonts match the font descriptor.

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

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

// output
[ { path: '/Library/Fonts/Arial.ttf',
    postscriptName: 'ArialMT',
    family: 'Arial',
    style: 'Regular',
    weight: 400,
    width: 5,
    italic: false,
    monospace: false },
  { path: '/Library/Fonts/Arial Bold.ttf',
    postscriptName: 'Arial-BoldMT',
    family: 'Arial',
    style: 'Bold',
    weight: 700,
    width: 5,
    italic: false,
    monospace: false } ]

findFont(fontDescriptor)

Returns a single font descriptors matching a query font descriptors as well as possible. This method 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.

// asynchronous API
fontManager.findFont({ family: 'Arial', weight: 700 }, function(font) { ... });

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

// output
{ path: '/Library/Fonts/Arial Bold.ttf',
  postscriptName: 'Arial-BoldMT',
  family: 'Arial',
  style: 'Bold',
  weight: 700,
  width: 5,
  italic: false,
  monospace: false }

substituteFont(postscriptName, text)

Substitutes the font with the given postscriptName with another font that contains the characters in text. If a font matching postscriptName is not found, a font containing the given characters is still returned. If a font matching postscriptName is found, its 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.

// asynchronous API
fontManager.substituteFont('TimesNewRomanPSMT', '汉字', function(font) { ... });

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

// output
{ path: '/Library/Fonts/Songti.ttc',
  postscriptName: 'STSongti-SC-Regular',
  family: 'Songti SC',
  style: 'Regular',
  weight: 400,
  width: 5,
  italic: false,
  monospace: false }

Font Descriptor

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 find fonts, but all methods return full font descriptors.

Name Type Description
path string The path to the font file in the filesystem. (not applicable for queries, only for results)
postscriptName string The PostScript name of the font (e.g 'Arial-BoldMT'). This uniquely identities a font in most cases.
family string The font family name (e.g 'Arial')
style string The font style name (e.g. 'Bold')
weight number The font weight (e.g. 400 for normal weight). Should be a multiple of 100, between 100 and 900. See below for weight documentation.
width number The font width (e.g. 5 for normal width). Should be an integer between 1 and 9. See below for width documentation.
italic boolean Whether the font is italic or not.
monospace boolean Whether the font is monospace or not.

Weights

Value Name
100 Thin
200 Ultra Light
300 Light
400 Normal
500 Medium
600 Semi Bold
700 Bold
800 Ultra Bold
900 Heavy

Widths

Value Name
1 Ultra Condensed
2 Extra Condensed
3 Condensed
4 Semi Condensed
5 Normal
6 Semi Expanded
7 Expanded
8 Extra Expanded
9 Ultra Expanded

License

MIT

font-manager's People

Contributors

attackgoat avatar devongovett avatar eugeny avatar fazendaaa avatar implausible avatar moriyoshi avatar princejwesley avatar rburgett avatar tanninone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

font-manager's Issues

Not compatible with Node.JS v11.0.0

> [email protected] install /home/spaceboyross/RDE/src/panel/node_modules/font-manager
> node-gyp rebuild

make: Entering directory '/home/spaceboyross/RDE/src/panel/node_modules/font-manager/build'
  CXX(target) Release/obj.target/fontmanager/src/FontManager.o
In file included from ../node_modules/nan/nan.h:194,
                 from ../src/FontManager.cc:5:
../node_modules/nan/nan_maybe_43_inl.h: In function ‘Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’:
../node_modules/nan/nan_maybe_43_inl.h:88:15: error: ‘class v8::Object’ has no member named ‘ForceSet’
   return obj->ForceSet(GetCurrentContext(), key, value, attribs);
               ^~~~~~~~
../node_modules/nan/nan_maybe_43_inl.h: In function ‘Nan::MaybeLocal<v8::Object> Nan::CloneElementAt(v8::Local<v8::Array>, uint32_t)’:
../node_modules/nan/nan_maybe_43_inl.h:220:17: error: ‘class v8::Array’ has no member named ‘CloneElementAt’
   return array->CloneElementAt(GetCurrentContext(), index);
                 ^~~~~~~~~~~~~~
In file included from ../node_modules/nan/nan_new.h:189,
                 from ../node_modules/nan/nan.h:200,
                 from ../src/FontManager.cc:5:
../node_modules/nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::BooleanObject>::return_t Nan::imp::Factory<v8::BooleanObject>::New(bool)’:
../node_modules/nan/nan_implementation_12_inl.h:40:38: error: no matching function for call to ‘v8::BooleanObject::New(bool&)’
   return v8::BooleanObject::New(value).As<v8::BooleanObject>();
                                      ^
In file included from /home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:5218:23: note: candidate: ‘static v8::Local<v8::Value> v8::BooleanObject::New(v8::Isolate*, bool)’
   static Local<Value> New(Isolate* isolate, bool value);
                       ^~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:5218:23: note:   candidate expects 2 arguments, 1 provided
In file included from ../node_modules/nan/nan_new.h:189,
                 from ../node_modules/nan/nan.h:200,
                 from ../src/FontManager.cc:5:
../node_modules/nan/nan_implementation_12_inl.h:40:60: error: expected primary-expression before ‘>’ token
   return v8::BooleanObject::New(value).As<v8::BooleanObject>();
                                                            ^
../node_modules/nan/nan_implementation_12_inl.h:40:62: error: expected primary-expression before ‘)’ token
   return v8::BooleanObject::New(value).As<v8::BooleanObject>();
                                                              ^
../node_modules/nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)’:
../node_modules/nan/nan_implementation_12_inl.h:340:37: warning: ‘static v8::Local<v8::Value> v8::StringObject::New(v8::Local<v8::String>)’ is deprecated: Use Isolate* version [-Wdeprecated-declarations]
   return v8::StringObject::New(value).As<v8::StringObject>();
                                     ^
In file included from /home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:26,
                 from /home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:5236:37: note: declared here
                 static Local<Value> New(Local<String> value));
                                     ^~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../node_modules/nan/nan_new.h:189,
                 from ../node_modules/nan/nan.h:200,
                 from ../src/FontManager.cc:5:
../node_modules/nan/nan_implementation_12_inl.h:340:37: warning: ‘static v8::Local<v8::Value> v8::StringObject::New(v8::Local<v8::String>)’ is deprecated: Use Isolate* version [-Wdeprecated-declarations]
   return v8::StringObject::New(value).As<v8::StringObject>();
                                     ^
In file included from /home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:26,
                 from /home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:5236:37: note: declared here
                 static Local<Value> New(Local<String> value));
                                     ^~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’:
../node_modules/nan/nan.h:821:60: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, func, argc, argv);
                                                            ^
In file included from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:171:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:91:42: note: in definition of macro ‘NODE_DEPRECATED’
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:821:60: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, func, argc, argv);
                                                            ^
In file included from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:171:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:91:42: note: in definition of macro ‘NODE_DEPRECATED’
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’:
../node_modules/nan/nan.h:835:62: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, symbol, argc, argv);
                                                              ^
In file included from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:164:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:91:42: note: in definition of macro ‘NODE_DEPRECATED’
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:835:62: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, symbol, argc, argv);
                                                              ^
In file included from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:164:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:91:42: note: in definition of macro ‘NODE_DEPRECATED’
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)’:
../node_modules/nan/nan.h:849:62: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, method, argc, argv);
                                                              ^
In file included from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:157:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:91:42: note: in definition of macro ‘NODE_DEPRECATED’
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:849:62: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, method, argc, argv);
                                                              ^
In file included from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:157:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:91:42: note: in definition of macro ‘NODE_DEPRECATED’
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h: In constructor ‘Nan::Utf8String::Utf8String(v8::Local<v8::Value>)’:
../node_modules/nan/nan.h:894:53: warning: ‘v8::Local<v8::String> v8::Value::ToString() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       v8::Local<v8::String> string = from->ToString();
                                                     ^
In file included from /home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:10242:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:904:74: warning: ‘int v8::String::WriteUtf8(char*, int, int*, int) const’ is deprecated: Use Isolate* version [-Wdeprecated-declarations]
         length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags);
                                                                          ^
In file included from /home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:26,
                 from /home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:2754:21: note: declared here
                 int WriteUtf8(char* buffer, int length = -1,
                     ^~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h: In member function ‘v8::Local<v8::Value> Nan::Callback::Call_(v8::Isolate*, v8::Local<v8::Object>, int, v8::Local<v8::Value>*) const’:
../node_modules/nan/nan.h:1467:5: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
     ));
     ^
In file included from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:171:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:91:42: note: in definition of macro ‘NODE_DEPRECATED’
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:1467:5: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
     ));
     ^
In file included from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:171:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:91:42: note: in definition of macro ‘NODE_DEPRECATED’
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../node_modules/nan/nan.h:1707:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
../node_modules/nan/nan.h: In function ‘bool Nan::SetAccessor(v8::Local<v8::Object>, v8::Local<v8::String>, Nan::GetterCallback, Nan::SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute)’:
../node_modules/nan/nan.h:1961:16: error: no matching function for call to ‘v8::Object::SetAccessor(v8::Local<v8::String>&, void (*&)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&), void (*&)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&), v8::Local<v8::Object>&, v8::AccessControl&, v8::PropertyAttribute&)’
     , attribute);
                ^
In file included from /home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:3454:37: note: candidate: ‘v8::Maybe<bool> v8::Object::SetAccessor(v8::Local<v8::Context>, v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::MaybeLocal<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::SideEffectType)’
   V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(
                                     ^~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:3454:37: note:   no known conversion for argument 2 from ‘Nan::imp::NativeGetter’ {aka ‘void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&)’} to ‘v8::Local<v8::Name>’
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h: In member function ‘int FontDescriptor::getNumber(v8::Local<v8::Object>, const char*)’:
../src/FontDescriptor.h:152:32: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       return value->Int32Value();
                                ^
In file included from /home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:26,
                 from /home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h: In member function ‘bool FontDescriptor::getBool(v8::Local<v8::Object>, const char*)’:
../src/FontDescriptor.h:163:34: warning: ‘bool v8::Value::BooleanValue() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       return value->BooleanValue();
                                  ^
In file included from /home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:26,
                 from /home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:2568:43: note: declared here
   V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
                                           ^~~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/FontManager.cc:2:
../src/FontManager.cc: At global scope:
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:494:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:528:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/FontManager.cc:223:1: note: in expansion of macro ‘NODE_MODULE’
 NODE_MODULE(fontmanager, Init)
 ^~~~~~~~~~~
In file included from /home/spaceboyross/.node-gyp/11.0.0/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/spaceboyross/.node-gyp/11.0.0/include/node/node_object_wrap.h:85:78:   required from here
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:9701:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../node_modules/nan/nan_object_wrap.h:66:61:   required from here
/home/spaceboyross/.node-gyp/11.0.0/include/node/v8.h:9701:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
../src/FontManager.cc: In instantiation of ‘Nan::NAN_METHOD_RETURN_TYPE getAvailableFonts(Nan::NAN_METHOD_ARGS_TYPE) [with bool async = true; Nan::NAN_METHOD_RETURN_TYPE = void; Nan::NAN_METHOD_ARGS_TYPE = const Nan::FunctionCallbackInfo<v8::Value>&]’:
../src/FontManager.cc:213:67:   required from here
../src/FontManager.cc:108:74: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     uv_queue_work(uv_default_loop(), &req->work, getAvailableFontsAsync, (uv_after_work_cb) asyncCallback);
                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/FontManager.cc: In instantiation of ‘Nan::NAN_METHOD_RETURN_TYPE getAvailableFonts(Nan::NAN_METHOD_ARGS_TYPE) [with bool async = false; Nan::NAN_METHOD_RETURN_TYPE = void; Nan::NAN_METHOD_ARGS_TYPE = const Nan::FunctionCallbackInfo<v8::Value>&]’:
../src/FontManager.cc:214:72:   required from here
../src/FontManager.cc:108:74: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
../src/FontManager.cc: In instantiation of ‘Nan::NAN_METHOD_RETURN_TYPE findFonts(Nan::NAN_METHOD_ARGS_TYPE) [with bool async = true; Nan::NAN_METHOD_RETURN_TYPE = void; Nan::NAN_METHOD_ARGS_TYPE = const Nan::FunctionCallbackInfo<v8::Value>&]’:
../src/FontManager.cc:215:51:   required from here
../src/FontManager.cc:135:66: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     uv_queue_work(uv_default_loop(), &req->work, findFontsAsync, (uv_after_work_cb) asyncCallback);
                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/FontManager.cc: In instantiation of ‘Nan::NAN_METHOD_RETURN_TYPE findFonts(Nan::NAN_METHOD_ARGS_TYPE) [with bool async = false; Nan::NAN_METHOD_RETURN_TYPE = void; Nan::NAN_METHOD_ARGS_TYPE = const Nan::FunctionCallbackInfo<v8::Value>&]’:
../src/FontManager.cc:216:56:   required from here
../src/FontManager.cc:135:66: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
../src/FontManager.cc: In instantiation of ‘Nan::NAN_METHOD_RETURN_TYPE findFont(Nan::NAN_METHOD_ARGS_TYPE) [with bool async = true; Nan::NAN_METHOD_RETURN_TYPE = void; Nan::NAN_METHOD_ARGS_TYPE = const Nan::FunctionCallbackInfo<v8::Value>&]’:
../src/FontManager.cc:217:49:   required from here
../src/FontManager.cc:164:65: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     uv_queue_work(uv_default_loop(), &req->work, findFontAsync, (uv_after_work_cb) asyncCallback);
                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/FontManager.cc: In instantiation of ‘Nan::NAN_METHOD_RETURN_TYPE findFont(Nan::NAN_METHOD_ARGS_TYPE) [with bool async = false; Nan::NAN_METHOD_RETURN_TYPE = void; Nan::NAN_METHOD_ARGS_TYPE = const Nan::FunctionCallbackInfo<v8::Value>&]’:
../src/FontManager.cc:218:54:   required from here
../src/FontManager.cc:164:65: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
../src/FontManager.cc: In instantiation of ‘Nan::NAN_METHOD_RETURN_TYPE substituteFont(Nan::NAN_METHOD_ARGS_TYPE) [with bool async = true; Nan::NAN_METHOD_RETURN_TYPE = void; Nan::NAN_METHOD_ARGS_TYPE = const Nan::FunctionCallbackInfo<v8::Value>&]’:
../src/FontManager.cc:219:61:   required from here
../src/FontManager.cc:204:71: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     uv_queue_work(uv_default_loop(), &req->work, substituteFontAsync, (uv_after_work_cb) asyncCallback);
                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/FontManager.cc: In instantiation of ‘Nan::NAN_METHOD_RETURN_TYPE substituteFont(Nan::NAN_METHOD_ARGS_TYPE) [with bool async = false; Nan::NAN_METHOD_RETURN_TYPE = void; Nan::NAN_METHOD_ARGS_TYPE = const Nan::FunctionCallbackInfo<v8::Value>&]’:
../src/FontManager.cc:220:66:   required from here
../src/FontManager.cc:204:71: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
make: *** [fontmanager.target.mk:102: Release/obj.target/fontmanager/src/FontManager.o] Error 1
make: Leaving directory '/home/spaceboyross/RDE/src/panel/node_modules/font-manager/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.18.16-arch1-1-ARCH
gyp ERR! command "/home/spaceboyross/.nvm/versions/node/v11.0.0/bin/node" "/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/spaceboyross/RDE/src/panel/node_modules/font-manager
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN @ross-technologies/[email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/spaceboyross/.npm/_logs/2018-11-05T21_15_36_347Z-debug.log

node 12.18.3 error

nodejs: 12
electron: 8.8.0

npm rebuild error:
BooleanValue can never throw. Use Isolate version.
[-Wdeprecated-declarations]
return value.ToLocalChecked()->BooleanValue(Nan::GetCurrentContext

Pull fonts from custom directory

Great library!

I'm wondering if there is a way to pull fonts from a custom directory. I'm working in an Electron app and have some fonts built in to the app. I like being able to get the metadata and the search feature in your library.

node 16 ,yarn 1.22.19 install error

E:\coding\linux_file\douyin_motrix>yarn add font-manager
yarn add v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning " > @vue/[email protected]" has unmet peer dependency "eslint@^7.12.1".
warning " > @vue/[email protected]" has unmet peer dependency "eslint-plugin-import@^2.22.1".
warning " > @vue/[email protected]" has unmet peer dependency "eslint-plugin-node@^11.1.0".
warning " > @vue/[email protected]" has unmet peer dependency "eslint-plugin-promise@^4.2.1 || ^5.0.0".
warning " > @vue/[email protected]" has unmet peer dependency "eslint-plugin-vue@^7.0.0".
warning "@vue/eslint-config-standard > [email protected]" has unmet peer dependency "eslint@^7.12.1".
warning "@vue/eslint-config-standard > [email protected]" has unmet peer dependency "eslint-plugin-import@^2.22.1".
warning "@vue/eslint-config-standard > [email protected]" has unmet peer dependency "eslint-plugin-node@^11.1.0".
warning "@vue/eslint-config-standard > [email protected]" has unmet peer dependency "eslint-plugin-promise@^4.2.1 || ^5.0.0".
warning "@vue/eslint-config-standard > [email protected]" has unmet peer dependency "eslint-plugin-import@>=1.4.0".
warning " > [email protected]" has unmet peer dependency "eslint@>= 4.12.1".
[5/5] Building fresh packages...
[1/5] ⢀ ffmpeg-static
[2/5] ⢀ sqlite3
[3/5] ⢀ electron
[-/5] ⢀ waiting...
error E:\coding\linux_file\douyin_motrix\node_modules\font-manager: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: E:\coding\linux_file\douyin_motrix\node_modules\font-manager
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.8.10 found at "C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe"

gyp info find VS using VS2017 (15.9.34118.181) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe
gyp info spawn args [
gyp info spawn args 'C:\Users\Administrator\AppData\Local\Yarn\Data\global\node_modules\node-gyp\gyp\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'E:\coding\linux_file\douyin_motrix\node_modules\font-manager\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\Administrator\AppData\Local\Yarn\Data\global\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\Administrator\AppData\Local\node-gyp\Cache\19.9.0\include\node\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\Administrator\AppData\Local\node-gyp\Cache\19.9.0',
gyp info spawn args '-Dnode_gyp_dir=C:\Users\Administrator\AppData\Local\Yarn\Data\global\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\Administrator\\AppData\\Local\\node-gyp\\Cache\\19.9.0\\<(target_arch)\\node.lib',
gyp info spawn args '-Dmodule_root_dir=E:\coding\linux_file\douyin_motrix\node_modules\font-manager',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'E:\coding\linux_file\douyin_motrix\node_modules\font-manager\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args 'build\binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
FontManager.cc
e:\coding\linux_file\douyin_motrix\node_modules\font-manager\src\fontdescriptor.h(176): error C2664: “bool v8::Value::BooleanValue(v8::Isolate *) const”: 无法将参数 1 从“v8::Localv8::Context”转换为“v8::Isolate *” [E:\coding\linux_file\douyin_motrix\node_modules\font-manager\build\fontmanager.vcxproj]
e:\coding\linux_file\douyin_motrix\node_modules\font-manager\src\fontdescriptor.h(176): note: 没有可用于执行该转换的用户定义的转换运算符,或者无法调用该运算符
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess. (C:\Users\Administrator\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\build.js:209:23)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Windows_NT 10.0.22000
gyp ERR! command "D:\coding\nvm_node\node.exe" "C:\Users\Administrator\AppData\Local\Yarn\Data\global\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd E:\coding\linux_file\douyin_motrix\node_modules\font-manager

Verification error on macOS Catalina

When you try to run font-manager on macOS Catalina, you get an error: "fontmanager.node" cannot be opened because the developer cannot be verified. Will notorization resolve this issue?

findFontsSync not returning all fonts in family

On my Windows 10 system, I have 4 font files in the Times New Roman family; times.ttf, timesbd.ttf, timesbi.ttf, timesi.ttf. When I make the following call:

let times = fm.findFontsSync({ family: 'Times New Roman' });

the result only holds two font files; times.ttf and timesbd.ttf.

Why doesn't the other two files appear as well?

OS X null pointer crash on font missing family attribute

Thanks for this and for fontkit, both are great libraries!

One of our designers ran into a crash on OS X that we tracked down to a font that was missing a "family" attribute.
Specifically, this line, where CTFontDescriptorCopyAttribute returns null, which eventually blows up when the resulting FontDescriptor gets coerced to JavaScript world.

Options for a fix seem to be:

  1. Checking the string attributes for null and falling back to a default (e.g., "No Family Detected"), or

  2. Ignoring fonts that have missing attributes. The approach I'd take on this is to allow createFontDescriptor to return null if the font is busted, and explicitly handle this null in the places where it's called (getAvailableFonts, findFonts, and substituteFont).

The reasoning for the second option is that a font that's missing a family is probably broken in other ways.
(Suitcase Fusion 6 describes the font that crashed font-manager as "corrupted".)

Happy to submit an OS X patch for whatever resolution you prefer.
(Would also be happy if you want to just code it up yourself.)

Thanks again for the great libraries!

License

Might you include a copy of the License (besides the package.json reference to MIT)?

search using list of families

is it possible to use findFont or findFonts for list of families ( preferred first ) - similar to css?

I can call findFont multiple times but I can't find "relevance score" in the result to be able to pick up best matching font

Can't install the font-manager through npm

Hey,
I get this error when i install the font-manager, am i missing something?

219 info install [email protected]
220 verbose unsafe-perm in lifecycle true
221 info [email protected] Failed to exec install script
222 verbose unlock done using C:\Users\Alexander\AppData\Roaming\npm-cache_locks\font-manager-6db06e008ef16939.lock for C:\Electron\font\node_modules\font-manager
223 verbose stack Error: [email protected] install: node-gyp rebuild
223 verbose stack Exit status 1
223 verbose stack at EventEmitter. (C:\Users\Alexander\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:212:16)
223 verbose stack at emitTwo (events.js:100:13)
223 verbose stack at EventEmitter.emit (events.js:185:7)
223 verbose stack at ChildProcess. (C:\Users\Alexander\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:14:12)
223 verbose stack at emitTwo (events.js:100:13)
223 verbose stack at ChildProcess.emit (events.js:185:7)
223 verbose stack at maybeClose (internal/child_process.js:821:16)
223 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
224 verbose pkgid [email protected]
225 verbose cwd C:\Electron\font
226 error Windows_NT 10.0.10586
227 error argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\Alexander\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "font-manager"
228 error node v5.5.0
229 error npm v2.1.18
230 error code ELIFECYCLE
231 error [email protected] install: node-gyp rebuild
231 error Exit status 1
232 error Failed at the [email protected] install script 'node-gyp rebuild'.
232 error This is most likely a problem with the font-manager package,
232 error not with npm itself.
232 error Tell the author that this fails on your system:
232 error node-gyp rebuild
232 error You can get their info via:
232 error npm owner ls font-manager
232 error There is likely additional logging output above.

Compatibility with NODE_MODULE_VERSION 64

I'm getting the following error when trying to use font-manager in my Electron app.

Uncaught Error: The module '/Users/justint/Documents/Dev/RenderTurbine/node_modules/font-manager/build/Release/fontmanager.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

Any plans to make font-manager compatible with the newer versions of Node? Thanks!


Font Manager: 0.3.0
NPM: 6.4.0
Node: 10.2.0
Electron: 3.0.9

Not compatible with gyp

linux 19.04
v10.15.2
error info:

../src/FontManager.cc: In instantiation of ‘Nan::NAN_METHOD_RETURN_TYPE substituteFont(Nan::NAN_METHOD_ARGS_TYPE) [with bool async = false; Nan::NAN_METHOD_RETURN_TYPE = void; Nan::NAN_METHOD_ARGS_TYPE = const Nan::FunctionCallbackInfov8::Value&]’:
../src/FontManager.cc:220:66: required from here
../src/FontManager.cc:204:71: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type]
make: *** [fontmanager.target.mk:104: Release/obj.target/fontmanager/src/FontManager.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/danmaku-to-ass/node_modules/font-manager/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.3.0-40-generic
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/danmaku-to-ass/node_modules/font-manager
gyp ERR! node -v v10.15.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-05-06T15_30_54_929Z-debug.log

Can anyone help me to solve this problem? Thanks a lot~

Crash on Windows 7 SP1

Hi,

I have a crash when using font-manager with electron 1.7.9 on Windows 7 with SP1. What I can tell is that it crashes with this callstack:

00 DWrite!DWriteCreateFactory+0x143b3
01 DWrite!DWriteCreateFactory+0x141b3
02 fontmanager!resultFromFont(struct IDWriteFont * font = 0x00000000`00383410)+0x1ad [c:\dev\node_modules\font-manager\src\fontmanagerwindows.cc @ 127]
03 fontmanager!getAvailableFonts(unsigned int64 _Count = <Value unavailable error>, void * _Ptr = <Value unavailable error>, class std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > _First = <Value unavailable error>)+0x1cb [c:\dev\node_modules\font-manager\src\fontmanagerwindows.cc @ 191]
04 fontmanager!getAvailableFonts<0>(class Nan::FunctionCallbackInfo<v8::Value> * info = 0x000007fe`effea7a0, class v8::Local<v8::Array> * handle = <Value unavailable error>)+0x11 [c:\dev\node_modules\font-manager\src\fontmanager.cc @ 112]
05 fontmanager!Nan::imp::FunctionCallbackWrapper(class v8::FunctionCallbackInfo<v8::Value> * info = 0x00000000`001aa660)+0xb6 [c:\dev\node_modules\font-manager\node_modules\nan\nan_callbacks_12_inl.h @ 175]
06 node!v8::internal::AllocationSpaceName+0x12cf0
...

When it fails the font being processed is the following:
0x00000000`05982040 "C:\WINDOWS\FONTS\ARIAL.TTF"

and the line of the crash seems around these:

      // this method requires windows 7, so we need to cast to an IDWriteFontFace1
      IDWriteFontFace1 *face1 = static_cast<IDWriteFontFace1 *>(face);
      bool monospace = face1->IsMonospacedFont() == TRUE;

Any idea why and how I could work around this issue?

Thanks,
Manu

Address boundary error on OS X

$ node
> var fm = require('font-manager')
undefined
> fm.getAvailableFontsSync()
fish: 'node' terminated by signal SIGSEGV (Address boundary error)

$ mocha node_modules/font-manager/test/index.js 
  font-manager
    ✓ should export some functions
    getAvailableFonts
      ✓ should throw if no callback is provided
      ✓ should throw if callback is not a function
fish: 'mocha node_modules/font-manager…' terminated by signal SIGSEGV (Address boundary error)

I am under OS X 10.11.4 and Nodejs v5.1.0. The Cpp module seems to have been compiled properly, however it crashes the node REPL. Am I doing it the wrong way?

Is not a valid win32 application

OS: Windows Server 2012 R2
64bit

image

I build in electronuserland/builder:wine which occurs this error, but when I build in windows everything goes well

Crash

Mac: When spellchecker and font-manager appear in the same process, electron crash!!!
Windows system is ok.

Compile error on MacOS X (node 13.7.0): no viable conversion from 'v8::Local<v8::Context>' to 'v8::Isolate *'

Lukaszs-MacBook-Pro:a milimetr$ ls
package.json
Lukaszs-MacBook-Pro:a milimetr$ npm install font-manager

> [email protected] install /private/tmp/a/node_modules/font-manager
> node-gyp rebuild

  CXX(target) Release/obj.target/fontmanager/src/FontManager.o
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:176:51: error: no viable conversion from 'v8::Local<v8::Context>' to 'v8::Isolate *'
      return value.ToLocalChecked()->BooleanValue(Nan::GetCurrentContext()).FromJust();
                                                  ^~~~~~~~~~~~~~~~~~~~~~~~
/Users/milimetr/Library/Caches/node-gyp/13.7.0/include/node/v8.h:2771:30: note: passing argument to parameter 'isolate' here
  bool BooleanValue(Isolate* isolate) const;
                             ^
1 error generated.
make: *** [Release/obj.target/fontmanager/src/FontManager.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/Cellar/node/13.7.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /private/tmp/a/node_modules/font-manager
gyp ERR! node -v v13.7.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/milimetr/.npm/_logs/2020-01-28T16_55_07_593Z-debug.log
Lukaszs-MacBook-Pro:a milimetr$

Mac OS X 10.12.6
iTerm2 3.3.4

monospace field is incorrect on Linux

When fetching the font metadata on Linux the monospace field is often incorrect saying true when it should be false. What is interesting is that finding fonts with a the monospace filter does work correctly. Consider the output of this code and its two lists. I would expect both lists to be the same:

const fontManager = require('font-manager');

const monofonts = fontManager.findFontsSync(  { monospace: true}).map( (font) => font.path);

const fonts = fontManager.getAvailableFontsSync();
const monofonts2 = fonts.filter( (font) => font.monospace).map( (font) => font.path);

monofonts.sort();
monofonts2.sort();

console.log("[findFonts]-----------------");
console.log(JSON.stringify(monofonts, null, "  "));
console.log("[getAvailableFonts & filter]-----------------");
console.log(JSON.stringify(monofonts2, null, "  "));

build error in windows 7 x64

"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" install font-manager

Exit code: 1

Standard error:
npm WARN package.json [email protected] No description
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd E:\workspace\MintReader2\node_modules\font-manager
gyp ERR! node -v v4.4.3
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "font-manager"
npm ERR! node v4.4.3
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the font-manager package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs font-manager
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls font-manager
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! E:\workspace\MintReader2\npm-debug.log

Standard output:

[email protected] install E:\workspace\MintReader2\node_modules\font-manager
node-gyp rebuild

E:\workspace\MintReader2\node_modules\font-manager>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
E:\workspace\MintReader2\node_modules\font-manager\build\fontmanager.vcxproj(20,3): error MSB4019: The imported project "E:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

undefined symbol

Electron version: 3.0.0-beta.*
OS: Ubuntu 16.04

Hello.
I just install font-manager, require it and run.
And I get next error:

/media/ruut/MyDisk/Soft/Programming/MyProjects/JS/figma-linux/node_modules/electron/dist/electron --inspect=5858 /media/ruut/MyDisk/Soft/Programming/MyProjects/JS/figma-linux/dist/main/main.js: symbol lookup error: /media/ruut/MyDisk/Soft/Programming/MyProjects/JS/figma-linux/node_modules/font-manager/build/Release/fontmanager.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE

Not compatible with Node.JS v12.13.0

Hi, i got an error when tried to install package with node 12.13

Here is output:

  CXX(target) Release/obj.target/fontmanager/src/FontManager.o
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:115:10: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
    res->Set(Nan::New<String>("path").ToLocalChecked(), Nan::New<String>(path).ToLocalChecked());
         ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3402:3: note: 'Set' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:116:10: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
    res->Set(Nan::New<String>("postscriptName").ToLocalChecked(), Nan::New<String>(postscriptName).ToLocalChecked());
         ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3402:3: note: 'Set' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:117:10: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
    res->Set(Nan::New<String>("family").ToLocalChecked(), Nan::New<String>(family).ToLocalChecked());
         ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3402:3: note: 'Set' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:118:10: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
    res->Set(Nan::New<String>("style").ToLocalChecked(), Nan::New<String>(style).ToLocalChecked());
         ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3402:3: note: 'Set' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:119:10: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
    res->Set(Nan::New<String>("weight").ToLocalChecked(), Nan::New<Number>(weight));
         ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3402:3: note: 'Set' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:120:10: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
    res->Set(Nan::New<String>("width").ToLocalChecked(), Nan::New<Number>(width));
         ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3402:3: note: 'Set' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:121:10: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
    res->Set(Nan::New<String>("italic").ToLocalChecked(), Nan::New<v8::Boolean>(italic));
         ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3402:3: note: 'Set' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:122:10: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
    res->Set(Nan::New<String>("monospace").ToLocalChecked(), Nan::New<v8::Boolean>(monospace));
         ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3402:3: note: 'Set' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:138:31: warning: 'Get' is deprecated: Use maybe version [-Wdeprecated-declarations]
    Local<Value> value = obj->Get(Nan::New<String>(name).ToLocalChecked());
                              ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3457:3: note: 'Get' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:149:31: warning: 'Get' is deprecated: Use maybe version [-Wdeprecated-declarations]
    Local<Value> value = obj->Get(Nan::New<String>(name).ToLocalChecked());
                              ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3457:3: note: 'Get' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:152:32: error: too few arguments to function call, single argument 'context' was not specified
      return value->Int32Value();
             ~~~~~~~~~~~~~~~~~ ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:2613:3: note: 'Int32Value' declared here
  V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:351:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:160:31: warning: 'Get' is deprecated: Use maybe version [-Wdeprecated-declarations]
    Local<Value> value = obj->Get(Nan::New<String>(name).ToLocalChecked());
                              ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3457:3: note: 'Get' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
In file included from ../src/FontManager.cc:6:
../src/FontDescriptor.h:163:21: error: no matching member function for call to 'BooleanValue'
      return value->BooleanValue();
             ~~~~~~~^~~~~~~~~~~~
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:2603:8: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
  bool BooleanValue(Isolate* isolate) const;
       ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:2606:51: note: candidate function not viable: requires single argument 'context', but no arguments were provided
                V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
                                                  ^
../src/FontManager.cc:23:10: warning: 'Set' is deprecated: Use maybe version [-Wdeprecated-declarations]
    res->Set(i++, (*it)->toJSObject());
         ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8.h:3411:3: note: 'Set' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/user/Library/Caches/node-gyp/12.13.0/include/node/v8config.h:311:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
make: *** [Release/obj.target/fontmanager/src/FontManager.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/user/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/user/.nvm/versions/node/v12.13.0/bin/node" "/Users/user/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/user/Projects/proj/client/node_modules/font-manager
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
npm WARN @bytelabsco/[email protected] requires a peer of @angular/core@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @bytelabsco/[email protected] requires a peer of rxjs@^5.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^2.1.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/forms@^2.1.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@^2.1.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^6.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of typescript@>=3.1.1 <3.3 but none is installed. You must install peer dependencies yourself.
npm WARN @ngtools/[email protected] requires a peer of typescript@>=2.4.0 < 3.3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/[email protected] (node_modules/@ffmpeg-installer/linux-arm):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/[email protected]: wanted {"os":"linux","arch":"arm"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/[email protected] (node_modules/@ffmpeg-installer/linux-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/[email protected]: wanted {"os":"linux","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/[email protected] (node_modules/@ffmpeg-installer/win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/[email protected]: wanted {"os":"win32","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/[email protected] (node_modules/@ffmpeg-installer/linux-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/[email protected]: wanted {"os":"linux","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/[email protected] (node_modules/@ffmpeg-installer/win32-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/[email protected]: wanted {"os":"win32","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/[email protected] (node_modules/@ffmpeg-installer/linux-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/[email protected]: wanted {"os":"linux","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node - gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2019-10-24T09_08_37_325Z-debug.log

Could you advise something?

compile error on windows 7 64bit when compile FontManagerWindows.cc

hi
i have get this error when install:

C:\Users\zoghal\node_modules\font-manager>node "C:\Users\zoghal\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-g
yp\bin\node-gyp.js" rebuild
child_process: customFds option is deprecated, use stdio instead.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  FontManager.cc
  FontManagerWindows.cc
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337): warning C4530: C++ exception handler used, but unwind semantics ar
e not enabled. Specify /EHsc (..\src\FontManager.cc) [C:\Users\zoghal\node_modules\font-manager\build\fontmanager.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337): warning C4530: C++ exception handler used, but unwind semantics ar
e not enabled. Specify /EHsc (..\src\FontManagerWindows.cc) [C:\Users\zoghal\node_modules\font-manager\build\fontmanager.vcxproj]
C:\Users\zoghal\node_modules\font-manager\node_modules\nan\nan.h(430): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible
loss of data (..\src\FontManagerWindows.cc) [C:\Users\zoghal\node_modules\font-manager\build\fontmanager.vcxproj]
C:\Users\zoghal\node_modules\font-manager\node_modules\nan\nan.h(430): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible
loss of data (..\src\FontManager.cc) [C:\Users\zoghal\node_modules\font-manager\build\fontmanager.vcxproj]
C:\Users\zoghal\node_modules\font-manager\node_modules\nan\nan.h(456): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible
loss of data (..\src\FontManagerWindows.cc) [C:\Users\zoghal\node_modules\font-manager\build\fontmanager.vcxproj]
C:\Users\zoghal\node_modules\font-manager\node_modules\nan\nan.h(456): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible
loss of data (..\src\FontManager.cc) [C:\Users\zoghal\node_modules\font-manager\build\fontmanager.vcxproj]
C:\Users\zoghal\node_modules\font-manager\node_modules\nan\nan.h(181): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible
loss of data (..\src\FontManager.cc) [C:\Users\zoghal\node_modules\font-manager\build\fontmanager.vcxproj]
          ..\src\FontManager.cc(19) : see reference to function template instantiation 'v8::Local<v8::Array> NanNew<v8::Array,unsigned __int64>
  (P)' being compiled
          with
          [
              P=unsigned __int64
          ]
..\src\FontManagerWindows.cc(457): warning C4267: 'argument' : conversion from 'size_t' to 'UINT32', possible loss of data [C:\Users\zoghal\nod
e_modules\font-manager\build\fontmanager.vcxproj]
     Creating library C:\Users\zoghal\node_modules\font-manager\build\Release\fontmanager.lib and object C:\Users\zoghal\node_modules\font-mana
  ger\build\Release\fontmanager.exp
  Generating code
  Finished generating code
  fontmanager.vcxproj -> C:\Users\zoghal\node_modules\font-manager\build\Release\\fontmanager.node
npm WARN unmet dependency C:\Users\zoghal\node_modules\yeoman\node_modules\grunt requires colors@'~0.6.0' but will load
npm WARN unmet dependency C:\Users\zoghal\node_modules\yeoman\node_modules\colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency C:\Users\zoghal\node_modules\yeoman\node_modules\prompt requires colors@'0.x.x' but will load
npm WARN unmet dependency C:\Users\zoghal\node_modules\yeoman\node_modules\colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency C:\Users\zoghal\node_modules\yeoman\node_modules\prompt\node_modules\winston requires colors@'0.x.x' but will load
npm WARN unmet dependency C:\Users\zoghal\node_modules\yeoman\node_modules\colors,
npm WARN unmet dependency which is version 0.6.0-1
[email protected] ..\..\node_modules\font-manager
└── [email protected]

how to fix this problem?

can't compile with electron

I tried electron-quick-start with font-manager module.

  1. git clone https://github.com/electron/electron-quick-start
  2. cd electron-quick-start
  3. npm install
  4. npm start <- i can
  5. npm install font-manager
  6. npm install --save-dev electron-rebuild
  7. add script "electron:rebuild":"electron-rebuild -f -w font-manager"

my environment

  • Ubuntu 18.04
  • node 12.13.1
  • npm 6.12.1

I'm sorry. I can't use english well. And this is my first issue.

electron-quick-start ❯❯❯ npm run electron:rebuild

> [email protected] electron:rebuild /home/ssssota/Documents/electron-quick-start
> electron-rebuild -w font-manager

✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild
make: ディレクトリ '/home/ssssota/Documents/electron-quick-start/node_modules/font-manager/build' に入ります
  CXX(target) Release/obj.target/fontmanager/src/FontManager.o
In file included from /home/ssssota/.electron-gyp/7.1.2/include/node/v8-internal.h:14:0,
                 from /home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:27,
                 from /home/ssssota/.electron-gyp/7.1.2/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/ssssota/.electron-gyp/7.1.2/include/node/v8config.h:343:49: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations]
   declarator __attribute__((deprecated(message)))
                                                 ^
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:8513:3: note: in expansion of macro ‘V8_DEPRECATE_SOON’
   V8_DEPRECATE_SOON("Use *WithData version.",
   ^~~~~~~~~~~~~~~~~
/home/ssssota/.electron-gyp/7.1.2/include/node/v8config.h:343:49: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations]
   declarator __attribute__((deprecated(message)))
                                                 ^
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:8522:3: note: in expansion of macro ‘V8_DEPRECATE_SOON’
   V8_DEPRECATE_SOON("Use *WithData version.",
   ^~~~~~~~~~~~~~~~~
In file included from ../src/FontManager.cc:6:0:
../src/FontDescriptor.h: In member function ‘bool FontDescriptor::getBool(v8::Local<v8::Object>, const char*)’:
../src/FontDescriptor.h:176:75: error: no matching function for call to ‘v8::Value::BooleanValue(v8::Local<v8::Context>)’
       return value.ToLocalChecked()->BooleanValue(Nan::GetCurrentContext()).FromJust();
                                                                           ^
In file included from /home/ssssota/.electron-gyp/7.1.2/include/node/node.h:63:0,
                 from ../src/FontManager.cc:2:
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:2653:8: note: candidate: bool v8::Value::BooleanValue(v8::Isolate*) const
   bool BooleanValue(Isolate* isolate) const;
        ^~~~~~~~~~~~
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:2653:8: note:   no known conversion for argument 1 from ‘v8::Local<v8::Context>’ to ‘v8::Isolate*’
In file included from /home/ssssota/.electron-gyp/7.1.2/include/node/v8-internal.h:14:0,
                 from /home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:27,
                 from /home/ssssota/.electron-gyp/7.1.2/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:2662:43: note: candidate: bool v8::Value::BooleanValue() const
   V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
                                           ^
/home/ssssota/.electron-gyp/7.1.2/include/node/v8config.h:328:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:2662:43: note:   candidate expects 0 arguments, 1 provided
   V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
                                           ^
/home/ssssota/.electron-gyp/7.1.2/include/node/v8config.h:328:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
fontmanager.target.mk:110: recipe for target 'Release/obj.target/fontmanager/src/FontManager.o' failed
make: *** [Release/obj.target/fontmanager/src/FontManager.o] Error 1
make: ディレクトリ '/home/ssssota/Documents/electron-quick-start/node_modules/font-manager/build' から出ます
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/ssssota/Documents/electron-quick-start/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.15.0-70-generic
gyp ERR! command "/usr/local/bin/node" "/home/ssssota/Documents/electron-quick-start/node_modules/.bin/node-gyp" "rebuild" "--target=7.1.2" "--arch=x64" "--dist-url=https://electronjs.org/headers" "--build-from-source"
gyp ERR! cwd /home/ssssota/Documents/electron-quick-start/node_modules/font-manager
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v6.0.1
gyp ERR! not ok 

Failed with exit code: 1

Error: make: ディレクトリ '/home/ssssota/Documents/electron-quick-start/node_modules/font-manager/build' に入ります
  CXX(target) Release/obj.target/fontmanager/src/FontManager.o
In file included from /home/ssssota/.electron-gyp/7.1.2/include/node/v8-internal.h:14:0,
                 from /home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:27,
                 from /home/ssssota/.electron-gyp/7.1.2/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/ssssota/.electron-gyp/7.1.2/include/node/v8config.h:343:49: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations]
   declarator __attribute__((deprecated(message)))
                                                 ^
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:8513:3: note: in expansion of macro ‘V8_DEPRECATE_SOON’
   V8_DEPRECATE_SOON("Use *WithData version.",
   ^~~~~~~~~~~~~~~~~
/home/ssssota/.electron-gyp/7.1.2/include/node/v8config.h:343:49: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations]
   declarator __attribute__((deprecated(message)))
                                                 ^
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:8522:3: note: in expansion of macro ‘V8_DEPRECATE_SOON’
   V8_DEPRECATE_SOON("Use *WithData version.",
   ^~~~~~~~~~~~~~~~~
In file included from ../src/FontManager.cc:6:0:
../src/FontDescriptor.h: In member function ‘bool FontDescriptor::getBool(v8::Local<v8::Object>, const char*)’:
../src/FontDescriptor.h:176:75: error: no matching function for call to ‘v8::Value::BooleanValue(v8::Local<v8::Context>)’
       return value.ToLocalChecked()->BooleanValue(Nan::GetCurrentContext()).FromJust();
                                                                           ^
In file included from /home/ssssota/.electron-gyp/7.1.2/include/node/node.h:63:0,
                 from ../src/FontManager.cc:2:
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:2653:8: note: candidate: bool v8::Value::BooleanValue(v8::Isolate*) const
   bool BooleanValue(Isolate* isolate) const;
        ^~~~~~~~~~~~
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:2653:8: note:   no known conversion for argument 1 from ‘v8::Local<v8::Context>’ to ‘v8::Isolate*’
In file included from /home/ssssota/.electron-gyp/7.1.2/include/node/v8-internal.h:14:0,
                 from /home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:27,
                 from /home/ssssota/.electron-gyp/7.1.2/include/node/node.h:63,
                 from ../src/FontManager.cc:2:
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:2662:43: note: candidate: bool v8::Value::BooleanValue() const
   V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
                                           ^
/home/ssssota/.electron-gyp/7.1.2/include/node/v8config.h:328:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
/home/ssssota/.electron-gyp/7.1.2/include/node/v8.h:2662:43: note:   candidate expects 0 arguments, 1 provided
   V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
                                           ^
/home/ssssota/.electron-gyp/7.1.2/include/node/v8config.h:328:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
fontmanager.target.mk:110: recipe for target 'Release/obj.target/fontmanager/src/FontManager.o' failed
make: *** [Release/obj.target/fontmanager/src/FontManager.o] Error 1
make: ディレクトリ '/home/ssssota/Documents/electron-quick-start/node_modules/font-manager/build' から出ます
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/ssssota/Documents/electron-quick-start/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.15.0-70-generic
gyp ERR! command "/usr/local/bin/node" "/home/ssssota/Documents/electron-quick-start/node_modules/.bin/node-gyp" "rebuild" "--target=7.1.2" "--arch=x64" "--dist-url=https://electronjs.org/headers" "--build-from-source"
gyp ERR! cwd /home/ssssota/Documents/electron-quick-start/node_modules/font-manager
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v6.0.1
gyp ERR! not ok 

Failed with exit code: 1
    at SafeSubscriber._error (/home/ssssota/Documents/electron-quick-start/node_modules/spawn-rx/lib/src/index.js:267:84)
    at SafeSubscriber.__tryOrUnsub (/home/ssssota/Documents/electron-quick-start/node_modules/rxjs/internal/Subscriber.js:205:16)
    at SafeSubscriber.error (/home/ssssota/Documents/electron-quick-start/node_modules/rxjs/internal/Subscriber.js:156:26)
    at Subscriber._error (/home/ssssota/Documents/electron-quick-start/node_modules/rxjs/internal/Subscriber.js:92:26)
    at Subscriber.error (/home/ssssota/Documents/electron-quick-start/node_modules/rxjs/internal/Subscriber.js:72:18)
    at MapSubscriber.Subscriber._error (/home/ssssota/Documents/electron-quick-start/node_modules/rxjs/internal/Subscriber.js:92:26)
    at MapSubscriber.Subscriber.error (/home/ssssota/Documents/electron-quick-start/node_modules/rxjs/internal/Subscriber.js:72:18)
    at SafeSubscriber._next (/home/ssssota/Documents/electron-quick-start/node_modules/spawn-rx/lib/src/index.js:242:65)
    at SafeSubscriber.__tryOrUnsub (/home/ssssota/Documents/electron-quick-start/node_modules/rxjs/internal/Subscriber.js:205:16)
    at SafeSubscriber.next (/home/ssssota/Documents/electron-quick-start/node_modules/rxjs/internal/Subscriber.js:143:22)
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] electron:rebuild: `electron-rebuild -w font-manager`
npm ERR! Exit status 255
npm ERR! 
npm ERR! Failed at the [email protected] electron:rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ssssota/.npm/_logs/2019-11-22T00_53_27_683Z-debug.log

nan 2.2.0 is required for v8 49.x

NaN 2.2.0 change log says,

Feature: Rename GC*logueCallback to GCCallback for > 4.0 3603435109f981606d300eb88004ca101283acec

I am using font-manager for my electron based application. Electron is upgraded to 0.37.x which is based on chrome 49.

In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:602:20: error: no type named 'GCEpilogueCallback' in 'v8::Isolate'
      v8::Isolate::GCEpilogueCallback callback
      ~~~~~~~~~~~~~^
../node_modules/nan/nan.h:608:20: error: no type named 'GCEpilogueCallback' in 'v8::Isolate'
      v8::Isolate::GCEpilogueCallback callback) {
      ~~~~~~~~~~~~~^
../node_modules/nan/nan.h:613:20: error: no type named 'GCPrologueCallback' in 'v8::Isolate'
      v8::Isolate::GCPrologueCallback callback
      ~~~~~~~~~~~~~^
../node_modules/nan/nan.h:619:20: error: no type named 'GCPrologueCallback' in 'v8::Isolate'
      v8::Isolate::GCPrologueCallback callback) {
      ~~~~~~~~~~~~~^
4 errors generated.

Possible to list fonts in user’s home directory?

On a regular OS X application (like TextEdit), the list of fonts available seems to also include fonts in the user’s home directory under $HOME/Library/Fonts. However, using font-manager seems to make only the fonts in the system folder available.

Is this a limitation of the CTFontCollectionCreateFromAvailableFonts function in CoreText, or am I missing something? It would be great to have all the fonts available, including the ones in the user’s home folder.

UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 2557: illegal multibyte sequence

Win7_64
node v12.16.1

K:\speech-bubble\nwjs-vue-cli>yarn add font-manager
yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@vue/cli-plugin-eslint > [email protected]" has incorrect peer dependency "eslint@>=1.6.0 <7.0.0".
warning " > [email protected]" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0".
[4/4] Building fresh packages...
[-/5] ⡀ waiting...
[-/5] ⡀ waiting...
[3/5] ⡀ ejs
[-/5] ⢀ waiting...
error K:\speech-bubble\nwjs-vue-cli\node_modules\font-manager: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: K:\speech-bubble\nwjs-vue-cli\node_modules\font-manager
Output:
K:\speech-bubble\nwjs-vue-cli\node_modules\font-manager>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.8.3 found at "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\python.exe"
gyp info find VS using VS2019 (16.6.30225.117) found at:
gyp info find VS "D:\����\Microsoft Visual Studio"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'K:\\speech-bubble\\nwjs-vue-cli\\node_modules\\font-manager\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Administrator\\AppData\\Local\\node-gyp\\Cache\\12.16.1\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Administrator\\AppData\\Local\\node-gyp\\Cache\\12.16.1',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\12.16.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=K:\\speech-bubble\\nwjs-vue-cli\\node_modules\\font-manager',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'K:\\speech-bubble\\nwjs-vue-cli\\node_modules\\font-manager\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 547, in main
    return gyp_main(args)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 520, in gyp_main
    [generator, flat_list, targets, data] = Load(
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 136, in Load
    result = gyp.input.Load(build_files, default_variables, includes[:],
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 2778, in Load
    LoadTargetBuildFile(build_file, data, aux_data,
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 390, in LoadTargetBuildFile
    build_file_data = LoadOneBuildFile(build_file_path, data, aux_data,
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 262, in LoadOneBuildFile
    LoadBuildFileIncludesIntoDict(build_file_data, build_file_path, data,
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 300, in LoadBuildFileIncludesIntoDict
    LoadOneBuildFile(include, data, aux_data, None, False, check),
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 233, in LoadOneBuildFile
    build_file_contents = open(build_file_path, 'rU').read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 2557: illegal multibyte sequence
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd K:\speech-bubble\nwjs-vue-cli\node_modules\font-manager

getAvailableFontsSync does not include manually installed font on Windows 10

I am not sure if this is an issue related to font-manager itself or rather something else that I'm doing wrong but since I don't know where else to look for help, I'll post the issue here.

I am having trouble locating the file for a manually installed font using getAvailableFontsSync (or also findFontSync) on a Windows 10 environment.

Steps to reproduce:

  1. Download a font, e.g. Fira Code
  2. Install the font by extracting the files, opening the font files by double-clicking them and then clicking "Install" in each of the preview windows
  3. Reboot the computer to make sure that the font catalog is updated
  4. Use getAvailableFontsSync to list all available fonts. No variant of Fira Code is included.
  5. Set your favorite text editor to use Fira Code as the font and watch it do so without any issues :(

I have been trying to find out if there is something special that makes DirectWrite's GetSystemFontCollection behave in this way but came up empty.

Maybe you can help me here?

Fontmanager fails to build under Node.js v9 and 10

When trying to install fontmanger under Node 9 or the newly released 10, fontmanager fails to build.

Here is the output of the failure on Node 10:

error /Users/mirigoyen/Git/projectname/node_modules/font-manager: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/mirigoyen/Git/projectname/node_modules/font-manager
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp info spawn /usr/local/bin/python2
gyp info spawn args [ '/Users/mirigoyen/Git/projectname/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/mirigoyen/Git/projectname/node_modules/font-manager/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/mirigoyen/Git/projectname/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/mirigoyen/.node-gyp/10.0.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/mirigoyen/.node-gyp/10.0.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/mirigoyen/Git/projectname/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/mirigoyen/.node-gyp/10.0.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/mirigoyen/Git/projectname/node_modules/font-manager',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/fontmanager/src/FontManager.o
In file included from ../src/FontManager.cc:5:
In file included from ../node_modules/nan/nan.h:194:
../node_modules/nan/nan_maybe_43_inl.h:88:15: error: no member named 'ForceSet' in 'v8::Object'
  return obj->ForceSet(GetCurrentContext(), key, value, attribs);
         ~~~  ^
../node_modules/nan/nan_maybe_43_inl.h:220:17: error: no member named 'CloneElementAt' in 'v8::Array'
  return array->CloneElementAt(GetCurrentContext(), index);
         ~~~~~  ^
In file included from ../src/FontManager.cc:5:
In file included from ../node_modules/nan/nan.h:200:
In file included from ../node_modules/nan/nan_new.h:189:
../node_modules/nan/nan_implementation_12_inl.h:40:38: error: too few arguments to function call, expected 2, have 1
  return v8::BooleanObject::New(value).As<v8::BooleanObject>();
         ~~~~~~~~~~~~~~~~~~~~~~      ^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/v8.h:4866:3: note: 'New' declared here
  static Local<Value> New(Isolate* isolate, bool value);
  ^
In file included from ../src/FontManager.cc:5:
In file included from ../node_modules/nan/nan.h:200:
In file included from ../node_modules/nan/nan_new.h:189:
../node_modules/nan/nan_implementation_12_inl.h:40:60: error: expected '(' for function-style cast or type construction
  return v8::BooleanObject::New(value).As<v8::BooleanObject>();
                                          ~~~~~~~~~~~~~~~~~^
../node_modules/nan/nan_implementation_12_inl.h:40:62: error: expected expression
  return v8::BooleanObject::New(value).As<v8::BooleanObject>();
                                                             ^
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:820:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:834:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/node.h:164:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:848:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/node.h:157:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:1461:31: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return scope.Escape(node::MakeCallback(
                              ^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:1957:7: error: no viable conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'Local<v8::Name>'
    , getter_
      ^~~~~~~
/Users/mirigoyen/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'const v8::Local<v8::Name> &' for 1st argument
class Local {
      ^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/v8.h:202:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'v8::Local<v8::Name> &&' for 1st argument
/Users/mirigoyen/.node-gyp/10.0.0/include/node/v8.h:206:13: note: candidate template ignored: could not match 'Local<type-parameter-0-0>' against 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)'
  V8_INLINE Local(Local<S> that)
            ^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/v8.h:3215:43: note: passing argument to parameter 'name' here
      Local<Context> context, Local<Name> name,
                                          ^
/Users/mirigoyen/.node-gyp/10.0.0/include/node/v8.h:213:5: error: assigning to 'v8::Context *' from incompatible type 'v8::String *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/mirigoyen/.node-gyp/10.0.0/include/node/v8.h:167:39: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                      ^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1956:7: note: in instantiation of function template specialization 'v8::Local<v8::Context>::Local<v8::String>' requested here
      name
      ^
4 warnings and 7 errors generated.
make: *** [Release/obj.target/fontmanager/src/FontManager.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/mirigoyen/Git/projectname/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/Users/mirigoyen/.nvm/versions/node/v10.0.0/bin/node" "/Users/mirigoyen/Git/projectname/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/mirigoyen/Git/projectname/node_modules/font-manager

library doesn't work with Node v.4.2.1

This is the first error I get:

In file included from ../src/FontManager.cc:5:
../node_modules/nan/nan.h:189:68: error: too many arguments to function call, expected at most 2, have 4
    return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);

Add charset matching

I'd like to use fontconfig to select nearest font that have some particular unicode characters in it ( for example, if I render big string of latin chars using Times face, and small substring is in arabic I'd prefer exact match for Times and any font with arabic glyphs for that small substring )

Compiling Error with node-gyp on Win10x64 and Electron

I am trying to get font-manager installed with electron.

Current System Setup:

  • Windows 10 x64
  • nodejs v6.2.0
  • npm 3.9.6
  • Visual Studio 2015 Community (With C++)

Following output is generated when run "install font-manager"

`electron-quick-start master > $ npm install font-manager

[email protected] install Q:\workspace\ALEXANDER\electron\electron-quick-start\node_modules\font-manager
node-gyp rebuild

Q:\workspace\ALEXANDER\electron\electron-quick-start\node_modules\font-manager>if not defined npm_config_node_gyp (node
"C:\Users\Alex\AppData\Local\scoop\apps\nodejs\6.2.0\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-g
yp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu ermöglichen, müssen Sie den Schalter "/m" hinzufügen.
FontManager.cc
FontManagerWindows.cc
..\src\FontManagerWindows.cc(462): warning C4267: "Argument": Konvertierung von "size_t" nach "UINT32", Datenverlust möglich [Q:\workspace\ALEXANDER\electron\electron-quick-start\node_modules\font-manager\build\fontmanager.vcxproj]
q:\workspace\alexander\electron\electron-quick-start\node_modules\nan\nan_new.h(208): warning C4267: "Argument": Konvertierung von "size_t" nach "int", Datenverlust möglich (Quelldatei wird kompiliert ..\src\FontManager.cc) [Q:\workspace
ALEXANDER\electron\electron-quick-start\node_modules\font-manager\build\fontmanager.vcxproj]
..\src\FontManager.cc(19): note: Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "v8: :Localv8::Array Nan::New<v8::Array,unsigned __int64>(A0)".
with
[
A0=unsigned __int64
]
win_delay_load_hook.c
Bibliothek "Q:\workspace\ALEXANDER\electron\electron-quick-start\node_modules\font-manager\build\Release\fontmanag
er.lib" und Objekt "Q:\workspace\ALEXANDER\electron\electron-quick-start\node_modules\font-manager\build\Release\font
manager.exp" werden erstellt.
Code wird generiert.
Codegenerierung ist abgeschlossen.
fontmanager.vcxproj -> Q:\workspace\ALEXANDER\electron\electron-quick-start\node_modules\font-manager\build\Release
fontmanager.node
[email protected] Q:\workspace\ALEXANDER\electron\electron-quick-start
-- [email protected] extraneous

If I then start electron via "npm start" the dev tools log:

ELECTRON_ASAR.js:158 Uncaught Error: Eine DLL-Initialisierungsroutine ist fehlgeschlagen. \\?\Q:\workspace\ALEXANDER\electron\electron-quick-start\node_modules\font-manager\build\Release\fontmanager.node

Is this a node-gyp issue? Or am I missing something?

Missing dependencies?

Am i missing some dependencies or?
I am getting this error

Uncaught Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\Electron\font-manager-knockout\node_modules\font-manager\build\Release\fontmanager.node

http://i66.tinypic.com/209t0lg.png

Thanks!

Library crashes when certain font present in Windows (screenshot provided)

I have been using this library on my system without trouble for a while, but I have had two client systems which the library refuses to run on. The problem is related to xfiles.ttf (http://cooltext.com/Download-Font-X-Files) which I found on both of their systems. If that font is present in Windows (both 32 and 64 bit), the library crashes. I recreated this on my system by running your tests successfully, then installing the font and running the tests again only to have them fail.

screenshot 10

Do you have any idea why this would be happening? I need this fixed before I can send the application to anyone else. If this font crashes the library, I worry that other fonts might do the same. This font does not crash any other Windows applications that I can find. It only crashes this library.

Thanks!

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.