Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@nagwa-limited/kashida-engine
Advanced tools
An engine to unify array of Arabic strings to the same width using Kashidas
A kashida engine that adds kashida to poem lines to unify their widths to match the widest text.
These instructions will guide you to consume the API provided by the app.
Following these instructions will integrate the app into your website and will provide a globally defined API to be used. Also, if you're using the Script tag method then the app will automatically add kashidas to the poem lines if the following structure is found in DOM, if not then check the Documentation to manually invoke the required functions.
<element class="poem">
<element class="linesGroup">
<div>
<div> [The line should exist here] </div>
</div>
</element>
<element class="linesGroup">
<div>
<div> [The line should exist here] </div>
<div> [The line should exist here] </div>
</div>
</element>
</element>
script
tagDownload the latest version of the app.
Link the app's Javascript file in the body of your HTML File. Example:
<body>
<script src="/static/js/kashida-engine.js"></script>
</body>
npm
Run the following command:
npm i kashida-engine
Here will explain the API provided by our app that can be found under the globally defined namespace NagwaHTMLEditor.
The KashidaEngine
is implementing the following interface:
interface KashidaEngine {
unifyTextsWidths: (texts: string[], font: string) => string[]
renderKashidaToPoems: (poemSelector?: string, lineSelector?: string) => void
renderKashidaToPoems: (e?: Event) => void
getTextWidth: (text: string, font: string) => number
getTextsWidths: (texts: string[], font: string) => TextWidths
}
interface TextWidths {
textWidths: number[]
maxTextWidth: number
}
Here's an explanation of the provided API:
KashidaEngine
:
unifyTextsWidths
: Unifies the widths of all the inputted texts to match the max width.renderKashidaToPoems
: Has two overloads to render all the poem lines after adding kashida to it and unifying all its widths for all the poems available on page and still be able to use it as an event handler by using the second overload that accepts an Event
as an argument.getTextWidth
: Uses canvas.measureText
to compute and return the width of the given text of given font in pixels.getTextsWidths
: Uses getTextWidth
to compute and return the widths of the given texts of given font in pixels and the max width of all the sentences.TextWidths
:
textWidths
: An array of the width of the sentences.maxTextWidth
: The maximum width of all of these widths.These instructions will get you a copy of the project up and running on your local machine.
You have to have Node.js v17.2.0, and npm v8.1.4 installed.
Also, check ./package.json
for all the packages used in this project.
Clone this repo, open the terminal and navigate to the repo directory on your local machine, and then run:
npm install
wait until it's done and you're good to go!
A commit messages consists of three distinct parts separated by a blank line: the title, an optional body and an optional footer. The layout looks like this:
type: subject
body
The type is contained within the title and can be one of these types:
Subjects should be no greater than 50 characters, should begin with a capital letter and do not end with a period.
Use an imperative tone to describe what a commit does, rather than what it did. For example, use change; not changed or changes.
Not all commits are complex enough to warrant a body, therefore it is optional and only used when a commit requires a bit of explanation and context. Use the body to explain the what and why of a commit, not the how.
When writing a body, the blank line between the title and the body is required and you should limit the length of each line to no more than 72 characters.
For more information about the style guide for Git and programming Languages check: Udacity's Code Style Guide or Conventional Commits
FAQs
An engine to unify array of Arabic strings to the same width using Kashidas
The npm package @nagwa-limited/kashida-engine receives a total of 17 weekly downloads. As such, @nagwa-limited/kashida-engine popularity was classified as not popular.
We found that @nagwa-limited/kashida-engine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.