vutran / os-fonts Goto Github PK
View Code? Open in Web Editor NEWRetrieve fonts available on your OS.
License: MIT License
Retrieve fonts available on your OS.
License: MIT License
Without the default useType parameter in getAll and getAllSync the lib could be useable in older projects.
useType ? useType : 'system';
For some reason, coverage is not being reported with coveralls.
Question : Which OS do you use?
The precommit is breaks on windows for me :
No matching files. Patterns tried: '{{mocks,test}/*.js' 'index.js' !/node_modules/ !./node_modules/**
Although if I remove the quotes from these : '{{mocks,test}/*.js' 'index.js' its perfectly working.
Are you working on darwin or linux?
npm run lint
should lint these files/directories:
index.js
__mocks__
__tests__
You cannot use path
with an undefined variable.
ฮป ~/Public/project/ master* node -i
> require('os-fonts');
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:1211:7)
at Object.<anonymous> (/Users/user/Public/project/node_modules/os-fonts/index.js:15:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
Thanks for the library!
I'm noticing in Windows that there are fonts listed in the C:\Windows\Fonts\ folder in which you find specific subfamily files like Bold, Italic, etc. For example, the Times New Roman font contains 4 different .ttf files but the filepaths are said to be like:
C:\Windows\Fonts\timesbd.ttf
os-fonts is finding them all and returning the paths as reported by the system, however, there seems to be no way of accessing the file by path directly. If you enter the above in file explorer you get:
Windows can't find C:\Windows\Fonts\timesbd.ttf. Check the spelling and try again.
I am a Mac user mainly but need to develop an app for both Windows and Mac from which the user can access their local files. This is creating a bit of a problem. Has this been an issue for you in your experience? If so, how did you overcome it?
Thanks again.
UPDATE: This was an issue where Chromium was stripping out the backslashes in the file path on Windows. Used slash to fix the problem. Would still love to know how to access the subfont ttf files in Windows Explorer.
Using it here https://github.com/crocodilejs/custom-fonts-in-emails ๐
I believe that if we pass useType
to be network
, and the path does not exist for the network folder, then we should return an empty array instead of throwing an error (because path.join
and fs.readDir
are reading a director that does not exist. Perhaps you could modify the code so that it checks fs.stats
if the directory exists, and if not return an empty array.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.