calculate-size

WebJar for calculate-size

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

calculate-size
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

calculate-size
WebJar for calculate-size
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/schickling/calculate-size

Download calculate-size

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/calculate-size/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>calculate-size</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/calculate-size/
implementation 'org.webjars.npm:calculate-size:1.1.1'
// https://jarcasting.com/artifacts/org.webjars.npm/calculate-size/
implementation ("org.webjars.npm:calculate-size:1.1.1")
'org.webjars.npm:calculate-size:jar:1.1.1'
<dependency org="org.webjars.npm" name="calculate-size" rev="1.1.1">
  <artifact name="calculate-size" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='calculate-size', version='1.1.1')
)
libraryDependencies += "org.webjars.npm" % "calculate-size" % "1.1.1"
[org.webjars.npm/calculate-size "1.1.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

calculate-size Build Status npm version

Calculate the pixel size (width/height) of a string (with integrated caching)

Install

This package supports Typescript out-of-the-box

$ npm install calculate-size

Usage

const size = calculateSize('Hello world!', {
   font: 'Arial',
   fontSize: '12px'
})

### Options

* `font: string`
* `fontSize: string`
* `fontWeight: string`
* `lineHeight: string`
* `width: string` (Constraint width by a fixed value to calc height)

console.log(size.width) // 140
console.log(size.height) // 20

Versions

Version
1.1.1