1.0.6 • Published 6 years ago

textent v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

node text extent

Only for win32

This is win32 C ++ modules on a Node.js. For calculating image height and width by using a font and font size to render the results given string.

Getting Started

Installation

npm install textent

If you want to build from source but not my pre-compiled binaries. Use:

npm install textent --build-from-source

Import to your code

We recommend using TypeScript or ES2015.

import textent from 'textent'

However, if you want to import in the traditional way:

const textent = require('textent').default

Quick API

render(fontName: string, fontSize: number, destString: string): size;

Contributing

Setting up your node compile environment

  1. Install VS2015 or higher version with Windows SDK.

  2. Install node-gyp and node-pre-gyp

npm install -g node-gyp node-pre-gyp

Prepare source code

git clone https://github.com/zyzsdy/textent.git
cd ./textent
npm install --build-from-source

Doing your magic

  1. Run the command below, then build/ will be setup.
node-pre-gyp configure
  1. Open build/binding.sln on Visual Studio

    text-extent.cc is the main module source code.

    Don't forget declare your method in index.d.ts to help editor and users know how to call your method.

Build or run

build

node-pre-gyp build

test

npm test

LICENSE

MIT

1.0.6

6 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago