The scientific document industry has undergone an important progress in all steps especially in processing and presentation. However, it is still confronted with major obstacles when it has to manipulate documents containing mathematical formulas which are based on dynamic or variable-sized mathematical symbols and taking care of optical scaling. Normally, in processing documents, the composition of mathematical formulas is based on static fonts. The support of
In the digital document industry, the presentation of some mathematical symbols, in terms of printing on papers or displaying on monitor screens, has not yet reached the quality offered by metal typesetting (old printing works). The problem relates exactly to symbols qualified to be dynamic. The latter change in size and/or shape depending on the context. Document processing relies on the text formatting (processing) tools and fonts encoding the characters. It is at the level of the fonts that the insufficiency of the support of the dynamic mathematical symbols resides. Precisely, what is missing is a mathematical model that supports this dynamism and thus allows improving the design (engineering) of dynamic fonts.
In scientific documents, mathematical formulas are composed of static and/or dynamic symbols. Using a font in a given size, the dimensions and shape of a static symbol do not change throughout the document. The character
The most interesting variable-sized symbols are the
Braces in metal typesetting.
The difference between linear scaling and optical scaling can be clearly seen when we consider examples of mathematical formulas with delimiters using computer fonts (instead of metal ones). Samples illustrating the two types of scaling are presented in Figures
Linear scaling of brace symbol.
Optical scaling of brace symbol.
The support of optical scaling requires the development of a dynamic font. In [
Linear scaling: size of font to supply basic thickness.
Semioptical scaling: scaling keeping the same thickness.
Figure
Also, with reference to Figure
The curve matching deals with the study of similarity. The notion of similarity has been studied a great deal and applied in many fields such as computer vision [
Our need is particular. The main concern consists of comparing two cubic Bézier curves. This comparison would provide a way to support a stretching model keeping similarity. Similarity constraints are not very strong in our case. Visually, the extended mathematical symbols should
The paper is organized as follows. The second section describes briefly some technical and aesthetic motivations to design a new font supporting dynamic mathematical symbols. In the third section, we define a way for comparing two curves linked by isometric or homothetic transformations. This method allows checking the similarity of two curves in an exact way. In the following section, we give a method to calculate the similarity between two curves which are not equal with respect to direct similitude. Then we present a method to study approximate similarity or similarity according to a given threshold
The main goal of this paper consists in presenting a mathematical model that allows developing fonts of dynamic mathematical symbols. Let us consider the parenthesis as example of a dynamic symbol to introduce the motivations of such a project. We need first to recall in an abstract way how documents are printed through (LA)TEX systems. When printing a document formatted with (LA)TEX, the bitmaps of the characters are used instead of the METAFONT language encoding. It is well known that applying some scaling operations to bitmaps diminishes the quality of the images. Consequently, the support of dynamic fonts based directly on bitmaps is not a feasible way to print documents in good quality. The problem has already been solved otherwise by D. E. Knuth. The approach is presented considering the parenthesis. D. E. Knuth has designed stand-alone parentheses (not composed from other characters) of different sizes as shown in Figure
Stand-alone left parentheses.
The previous idea cannot be used to solve entirely the problem, since it is necessary to give a large number of parentheses in different sizes to cover all the needs. In addition, we cannot predict in a meaningful way a maximum size of mathematical formulas. When a parenthesis of a height exceeding the highest stand-alone parenthesis is needed, (LA)TEX uses a compound parenthesis based on three characters:
A left compound parenthesis.
DynMath, a package developed on the basis of the mathematical model presented in this article, allows managing parentheses in PostScript Type 3 of sizes satisfying exactly the needs of the formula. Even in the case of large formulas, the delimiter produced by DynMath retains the form of a parenthesis (see Figure
It is very reasonable to consider motivations from an aesthetic point of view. First, we have to notice that the DynMath package comes to extend the formatting capabilities of (LA)TEX, concerning especially the aesthetic point of view. We can work with both in the same document. When it is to compare the mathematical delimiters of (LA)TEX and DynMath from the aesthetic point of view, people can have different opinions and this is natural. However, a kind of consecration of DynMath has already been done in the TUGboat 2016 conference held in Toronto, Canada [
A no less aesthetic motivation of the project is that the approach presented can be used to model the calligraphic stretchings of the characters of the Arabic script. The stretching of some letters can be accompanied by large deviations from the rules of Arabic calligraphy. An unacceptable writing through stretching some letters can rapidly be produced. The model can therefore help to prevent such uncomfortable situations.
The comparison of curves to supply the optical scaling is not a new idea. Actually, a work in mathematical formalization has been done as a mandatory part toward elaborating a dynamic font respecting the Arabic calligraphy [
Let
Another way to write the equality of two curves is
The notion of direct orthogonal range is defined in [
Let
In this part, we define an equality relation between curves with reference to homothetic transformations. This means that there is an isometric equality after applying homothety to one of the two curves.
Let us consider two Bézier curves
Let
By definition, a map of
Also for homothety of ratio
Now, let us consider similitude
Then,
It follows that
But we have
We get that
From what comes, we get that
So
Now, it is time to define the notion of exact similarity (nonapproximative). The last will be used as a reference to define the similarity in an approximating way.
When two curves
We have the equality of the direct orthogonal range for any
In addition to the almost null sum, to get the similarity, we add the fact that the two curves have the same geometric characteristics.
Consider the two curves
Curve
Curve
We aim at calculating the amount
Consider a Bézier curve
The two curves
Curve
Curve
Now, consider
Curve
With a precision
Now, let one consider two curves
The problem can be solved by comparing curves with passing to unit dimensions. The approach is presented considering the previous curves
An important property of the function
Consider two Bézier curves
Let
Since
We get
With the comparison formula (
We notice that the value of similarity diminished comparatively to the obtained previously values.
The function
With
The similarity measurement formula can be further improved by studying a set of properties to be verified by the sum of the squares of the orthogonal range differences when the curve is located in a given disc. This is the goal of the next section.
We consider two sets
In comprehension,
Suppose that
Two points
We can state a first property concerning the two parts.
Let
Let
Consequently,
Consider a Bézier curve
Let
Let
From Property
So
In the sequel, we state a property that relates to cross product of a vector in disc
Let
Let
We have
So
We get that
Consequently,
Finally, we have
We consider two Bézier curves
We have So Also, we have It follows that Consequently, we will get This point is a direct result of the previous one. This point is a direct result of the previous one.
Consider two Bézier curves
We have
So
Applying Property
From this property, we notice that, for all Bézier curves
We consider two cubic Bézier curves
In this section, we will show how to define a nonlinear model for stretching of cubic Bézier curves respecting similarity and geometric characterization properties. For simplicity, a Bézier curve
Let
Let
Under constraints
Here, we notice that if
To study the relationship between the similarity and the stretching vector
Top part of the left parenthesis.
Some stretchings of
Different extensions of left curve of the top part of left parenthesis.
Left curve in initial size
Three different horizontal stretchings, 0, 200, 400, for the same vertical amount,
We can notice that, for a constant amount of the vertical extension
Variation of the similarity according to
|
1200 | ||||
|
0 | 100 | 200 | 300 | 400 |
|
|
|
|
|
|
As for horizontal variations, the similarity also loses its quality when
Variation of the similarity according to variation of
|
0 | 500 | 100 | 1500 | 2000 |
|
0 | 166.67 | 333.33 | 500 | 666.67 |
|
|
|
|
|
|
This section deals with the relationship between the similarity of curves and the decomposition of Bézier curves. Let us consider once again the two curves considered in the beginning (Figures
The value of similarity between these two curves is
Similarity variation according to Bézier refinement.
|
||||||
---|---|---|---|---|---|---|
0 | 4 | 9 | 12 | 13 | 19 | |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
||
|
|
|
|
|
||
|
|
|
|
|
||
|
|
|
|
|||
|
|
|
|
|||
|
|
|
|
|||
|
|
|
|
|||
|
|
|
|
|||
|
|
|
||||
|
|
|
||||
|
|
|
||||
|
|
|||||
|
||||||
|
||||||
|
||||||
|
||||||
|
||||||
|
To show the role of Bézier’s decomposition in similarity and extension, let us consider the curves defining the upper part of the left parenthesis together. The extension values used to highlight the problems are very large.
The height of the half-parenthesis is 490.27809 in the PostScript unit (see the concrete coordinates above). This height is given in 1000 body size (1000 is the base size for specifying a PostScript font). The notion of “body size” in PostScript is equivalent to “font size.” The height of paper
Then
Let
The horizontal amount of stretching adopted to study the effect of decomposition is
We saw in Section
Let us consider the following items:
The curve
We chose to give a concrete example, the parenthesis symbol. We worked with the 96 body size so that the concepts to be highlighted are more clear. The shape is delimited by two curves to be extended, namely,
The stretching fractions
Let
Similarity variation of the shape of the left parenthesis according to Bézier refinement.
|
||||||
---|---|---|---|---|---|---|
0 | 2 | 4 | ||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|||
|
|
|||||
|
|
|||||
|
||||||
Moy |
|
|
|
|
|
|
The left half parenthesis (to stretch) is given in 96 body size in Figure
Improvement of the global shape similarity according to multirefinement and the same stretching vector
Top part of left parenthesis in body size 96 without stretching
Top part of left parenthesis curves, in body size 96, stretched and not refined
Top part of left parenthesis curves, in body size 96, stretched and multirefined to order 2
Top part of left parenthesis curves, in body size 96, stretched and multirefined to order 4
Table
As an application of the stretching model, a dynamic mini-font and a mini-package called DynMath were designed and presented at TUG 2016. The illustration is interesting when considering the dynamic symbols such as delimiters, namely, the parentheses and the braces. These two symbols represent very well the class of dynamic mathematical symbols. Indeed, the parenthesis contains curves (not lines) without inflection, while the braces present inflections. With this model, one can now compose, for example, large parentheses and braces like those of the metal age printing (what is not possible with (LA)TEX). In Figures
Parentheses under normal (LA)TEX and under DynMath.
Big parenthesis in normal (LA)TEX
Big parentheses in DynMath
Braces under normal (LA)TEX and under DynMath.
Big braces in normal (LA)TEX
Big braces in DynMath
We have developed a basic formal approach to design a dynamic font that supports extensible mathematical symbols. This was used to develop a mini-font of four symbols, namely, parentheses and braces. The result is very satisfactory and ensures the good model for the development of other dynamic mathematical symbols. Our work will be extended in terms of the stretching model and the method to calculate the similarity in order to allow the development of dynamic fonts supporting the rules of Arabic calligraphy.
The authors declare that there are no conflicts of interest regarding the publication of this paper.