GithubHelp home page GithubHelp logo

ifndefdeadmau5 / string-pixel-width-kr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adambisek/string-pixel-width

0.0 2.0 0.0 295 KB

Blazingly fast measure Korean string width in pixels on the server in Javascript (Node.Js)

JavaScript 99.53% HTML 0.47%

string-pixel-width-kr's Introduction

Korean text width measurement on the backend in Javascript.

Article from the original library author

Installation

To install the stable version:

npm install --save string-pixel-width-kr

Supported fonts:

  • Noto Sans KR

Example

var pixelWidth = require('string-pixel-width');

const width = pixelWidth('이 텍스트의 width는 얼마일까요?');


How to contribute

PRs are welcome :) This library uses static map of width of every ASCII letter for all supported fonts.

  1. Clone the repository
  2. Open file src/pixelWidthCalculator.html in your editor
  3. Add your font name into array of fonts (currently var websafe) and save
  4. Open up src/pixelWidthCalculator.html in Google Chrome. It should look like this: PHPStan
  5. Map of withs will be generated for you - copy it and replace content of file src/widthsMap.js

Please everytime make sure you don't broke existing fonts - remove any font or broke his widths.

string-pixel-width-kr's People

Watchers

 avatar  avatar

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.