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 dynamic mathematical symbols requires, in addition to the choice of adequate type of fonts and text formatting tools, the development of a mathematical model allowing parametrizing the symbols to support optical scaling. In this paper, we present a method to supply stretching of Bézier curves representing symbols without losing the aspect of similarity and the geometric characteristics of the concerned symbols. The curves of dynamic symbols to be parametrized are designed on the basis of a new method that allows measuring similarity. The model can be extended later for the development of dynamic fonts respecting the rules of Arabic calligraphy. The method to evaluate the similarity can also be easily adapted in other fields such as image processing.

1. Overview

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 α and the operator + are some examples representing the static class of symbols. A dynamic or variable-sized symbol varies in terms of size and/or sometimes shape depending on the context. As example of dynamic symbols, we can cite the hat diacritic modeling angles: A^ and AOB^ can be considered examples.

The most interesting variable-sized symbols are the delimiters such as parentheses and braces. These symbols’ sizes vary according to the typesetting context to delimit a mathematical formula. In Figure 1, braces are used to delimit mathematical scripts in different contexts. Note that the braces are of different sizes without being bound by a linear magnification ratio. Indeed, in terms of height as well as in terms of thickness, the ratios are not the same. This concept is called optical scaling. It is used to apply scaling taking into account the satisfaction of the reader’s eye. That is why it is called “optical.” The content of Figure 1 has been taken from an old book of mathematics , while the latter has been produced through printing based on metal typesetting.

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 2 and 3.

Linear scaling of brace symbol.

Optical scaling of brace symbol.

The support of optical scaling requires the development of a dynamic font. In [2, 3], the type of the font and the way to supply the concept of optical scaling are studied. Even, a PostScript Type 3 mini-font and a mini-package have been implemented and tested. In the present paper, the mathematical formalization supporting the work in [2, 3] is communicated. In reality, the support of the optical scaling and therefore the ability of processing scientific documents with good quality of typesetting are more a problem of finding a supporting mathematical model than of the choice of the type of fonts and the document processing tools. The author of [2, 3], in developing the package, obtained the support of the optical scaling on the basis of two tasks. The first one consists of linear scaling to determine the basic thickness of the mathematical symbol and the second one concerns scaling (a stretching) keeping the thickness previously obtained unchanged. The two tasks are illustrated in Figures 4 and 5. Figure 4 shows an abstract mathematical formula modeled by a simple gray rectangle. This mathematical formula is to be delimited by a left parenthesis. First, the parenthesis is set to the convenient dimensions of the body size fs. The font size has not been produced anyhow. It has been specifically calculated (see [2, 3] to get the idea on the way to calculate fs). Then, the size of the half of the parenthesis hfs is determined, which then makes it possible to deduce h, the necessary amount to extend the half of parenthesis.

Linear scaling: size of font to supply basic thickness.

Semioptical scaling: scaling keeping the same thickness.

Figure 5 highlights the following step to support the optical scaling. The parenthesis obtained previously is stretched vertically according to the amount h without acting on the thickness to cover all the abstract mathematical formula. The way to supply a nonlinear stretching model keeping the same thickness is the goal of the paper.

Also, with reference to Figure 5, in order to accomplish this extension, our model should ensure the conservation of some properties characterizing curves as the thickness, the geometric characteristics, and the similarity. We can verify visually these things by considering the parenthesis in Figures 4 and 5. Indeed, the PostScript font developed to be the base to handle dynamic symbols is parametrized according to a stretching model conserving these three properties.

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 [4, 5], pattern recognition , and speech recognition . In computational geometry, the correspondence between curves has been often computed by considering the curves as polylines. This has a meaning, since any curve to be processed in a computer should ultimately be discretized into series of connected segments. However, techniques for studying the similarity of continuous curves have been developed. The Fréchet distance, by its definition , can be used as a discrete and continuous mean to study the similarity. Other techniques, originally created to be applied in the discrete domain as DTW (Data Time Warping), have undergone extensions to support the case of continuous curves .

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 look as they were in the initial state. We do not need a technique based on curvatures like the “Fast Marching Method” or other approaches based on the minimization of paths or parametrizing functions as in [8, 9]. We will develop a method for comparing cubic Bézier curves (parametric curves) and, in particular, curves that result from a transform of other curves by similitude or other transformations such as optical scaling (that is not a linear magnification). This method will help in evaluating the exact or approached similarity. Actually, when the curve is the transform of another one by similitude, the similarity equals zero (exact similarity); otherwise, the method gives an approximate value to compare with a threshold. Here, we can explain a detail that will help us to make the difference between linear scaling and optical one: a linear scaling occurs when a shape is scaled everywhere according to a given ratio, for example, when similitude of ratio λ is applied to a geometric shape. On the other hand, optical scaling occurs when the shape undergoes unbalanced homothety (dilation) or some transformations which are not affine mappings.

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 ε. In the fifth section, a stretching model of cubic Bézier curves is defined. This model acts with conservation of the similarity, geometric characteristics, and the thickness between the curve and its stretched form. The paper ends with some conclusions and perspectives.

2. Some Technical and Aesthetic Motivations

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 6. When the height of a mathematical formula is less than the heights of these five parentheses (see Figure 6), the closest parenthesis in terms of size is used to delimit the formula.

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: and . The last one is repeated as many times as needed between the first and the second to optimally cover the formula to be delimited. A sample of a compound parenthesis is shown in Figure 7. Two important things are noted. The first one concerns the fact that the parenthesis used being stand-alone or compound will not be always exactly of the same height as the formula to delimit. The second one relates particularly to the compound parenthesis. In fact, the latter part differs from the first five ones in terms of shape. This leads therefore to a loss of uniformity. Let us notice that these are the symbols in Figure 6 which are true parentheses.

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 5).

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 [2, 3]. The work has been accepted and really appreciated.

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.

3. Comparison of Bézier Curves<italic> Exactly Similar</italic>

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 [10, 11]. In that work, the stretching concerns only one curve and, in addition, the transformers of curves to compare are simply shifts. The content of this section and so, our method to study similarity, is based on some concepts developed in works such as [10, 11].

3.1. Comparison of Isometric Bézier Curves (Equality of Curves) Definition 1 (equality of curves in plane).

Let B1 and B2 be two cubic Bézier (parametrized) curves defined in R2. We define the equality relation:(1)B1=cB2B1×B1-G1=B2×B2-G2on  0,1,where G1 and G2 are centroids of control points of B1 and B2, respectively.

Another way to write the equality of two curves is (2)B1=cB2B1×B1-G1=B2×B2-G2on  0,1,B1=cB2B1×B1-G1-B2×B2-G2=0R3on  0,1.Then, the equality formula will be (3)B1=cB2B1×B1-G1-B2×B2-G2=0R3on  0,1.

The notion of direct orthogonal range is defined in . Given a parametrized curve C, the direct orthogonal range on t0,1 with respect to a given vector u is the amount u×Ct-O, where O=0,0,0R3. B×B-G represents also a direct orthogonal range but relative to the vector B and the centroid G.

Let B1 and B2 be two cubic Bézier curves. We realize that if B1=cB2, then B2 is the map of B1 by an affine isometry. From this point of view, we will talk about B1=cB2 or more precisely about isometric equality. We can say simply that the two curves are isometric.

3.2. Homothetic Based Comparison of Cubic Bézier Curves

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 B1 and B2.

Definition 2 (homothetic equality).

B 1 and B2 are said to be in homothetic equality if and only if μR such that B1 and μB2 are in isometric equality (B1=cμB2).

Property 1.

Let B be a cubic Bézier (parametrized) curve; then the maps of B by direct similitude are homothetically equal to B.

Proof.

By definition, a map of B by an isometry is equal to B and so the property is verified with μ=1.

Also for homothety of ratio λ, we will take μ=1/λ.

Now, let us consider similitude S.

Then, S=ih, where i is an isometry and h is homothety of ratio λ.(4)SB1=ihB1=B2.

It follows that ihB1=iλB1=λiB1=B2.

But we have iB1=cB1.

We get that λiB1=cλB1 and so B2=cλB1.

From what comes, we get that B1=c(1/λ)B2.

So μ=1/λ such that B1=cμB2.

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.

Definition 3 (exact similarity or 0-similarity).

B 1 and B2 are exactly similar or 0-similar if and only if ηR such that B1=cηB2. In other words, ηR,B1×B1-G1-η2B2×B2-G2=0R3on  0,1.

4. Comparison of Cubic Bézier Curves Approximately Similar (<inline-formula><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" id="M70"><mml:mrow><mml:mi>ε</mml:mi></mml:mrow></mml:math></inline-formula>-Similarity)

When two curves B1 and B2 are to be compared, suppose that B2 is a map of B1 by direct similitude; then there is an exact similarity between B1 and B2, since we have ηR,B1=cηB2.

We have the equality of the direct orthogonal range for any t0,1. But, to get a similarity in the approximate sense, it is enough that the sum of modules of B1×B1-G1-η2B2×B2-G2 on 0,1 approaches the value 0 or is less than ε (where ε>0).

In addition to the almost null sum, to get the similarity, we add the fact that the two curves have the same geometric characteristics.

4.1. Summation of Squares of Orthogonal Range Differences

Consider the two curves B1 and B2 that are in Figures 8 and 9. B2 is not obtained from B1 by an affine mapping. There is no exact similarity between these two curves. However, they have the same geometric characteristics. Both are monotonic arches.

Curve B1.

Curve B2.

We aim at calculating the amount φ defined in the following equation:(5)φB1,B2=01B1×B1-G1-μ2B2×B2-G22dtμR.

μ is a coefficient allowing determining from B2, by homothety, a curve μB2 close, in terms of similarity, to B1. Let B1 and B2 be two curves to be compared; an important step consists in providing a way to determine a value of μ. For this, we need to define the notion of associated circle to a Bézier curve (Cf. Definition 4).

Definition 4 (associated circle).

Consider a Bézier curve B of control points P0, P1, P2, and P3. Let G be the centroid of the points P0, P1, P2, and P3. This means that G=(1/4)P0+P1+P2+P3. Then, the circle associated with B is the circle having G as center and r=maxi=03GPi as a radius.

The two curves B1 and B2 are retaken in Figures 10 and 11 considering their associated circles. We notice that the two associated circles are not of the same dimensions.

Curve B1 with its associated circle.

Curve B2 with its associated circle.

Now, consider μ=r1/r2, where r1 and r2 are radii of circles associated, respectively, with B1 and B2. Then the circle associated with μB2 has r1 as radius. In other words, B1 and μB2 have isometric associated circles and so they can be compared in terms of similarity. The curve μB2 is shown in Figure 12.

Curve μB2 with the associated circle: μ=0.846633.

With a precision ε=9500 and the calculated μ=0.846633, the value of φB1,B2 defined in (5) is φ=7641.16. The sum of squares of direct orthogonal range differences is less than ε; let φ<ε. We will simply say that B1 and B2 are ε-similar. One can have some criticisms on ε. In fact, what is a precision with value around a few thousands? We will understand that in the following and we will define, by the way, a method to study the similarity with acceptable precision around values close to zero.

Now, let one consider two curves B3 and B4 to be compared in terms of similarity relative to the same precision ε. Suppose that B3 and B4 verify B3=λB1 and B4=λB2, where λ=1.3. Due to Definition 2, B1 and B3 are linked by an exact similarity. The same property is also satisfied between B2 and B4. From the above, B1 and B2 are ε-similar. We can check that φB3,B4=λ2φB1,B2=12913.6. We find that φB3,B4ε and then B3 and B4 are not ε-similar. So (5) does not allow the definition of an adequate method to study the similarity of curves.

The problem can be solved by comparing curves with passing to unit dimensions. The approach is presented considering the previous curves B1 and B2. In order to compare these two curves in terms of similarity, it will be enough to compare (1/r1)B1 and (1/r2)B2. We notice that the circles associated with these two curves have radii equal to 1. Then the value of the parameter μ will be one. Formula (5) becomes(6)ψB1,B2=011r12B1×B1-G1-1r22B2×B2-G22dt,where r1 and r2 are radii of the circles associated with curves B1 and B2, respectively.

An important property of the function ψ can be stated.

Property 2.

Consider two Bézier curves B1 and B2. r1 and r2 are, respectively, radii of circles associated with B1 and B2. Let B3 and B4 be two curves such that B3=λB1 and B4=γB2. Then, we have(7)ψB1,B2=ψB3,B4.

Proof.

Let r3 and r4 be radii of the circles associated with B3 and B4, respectively.

Since B3=λB1 and B4=γB2, we have r3=λr1 and r4=γr2.

We get (8)ψB3,B4=011r32B3×B3-G3-1r42B4×B4-G42dt=011λ2r12λB1×λB1-λG1-1γ2r22γB2×γB2-γG22dt=011r12B1×B1-G1-1r22B2×B2-G22dt=ψB1,B2.

With the comparison formula (6), we get ψB1,B2=ψB3,B4=0.0000467439.

We notice that the value of similarity diminished comparatively to the obtained previously values.

The function ψ can be written in another way that seems to be easier to link with φ defined in (5):(9)ψB1,B2=1r1401B1×B1-G1-μ2B2×B2-G22dt.

With μ=r1/r2, r1 and r2 are radii of circles associated with B1 and B2.

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.

4.2. Some Properties on Discs (Unitary Discs) in <inline-formula><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" id="M198"><mml:mrow><mml:msup><mml:mrow><mml:mi mathvariant="double-struck">R</mml:mi></mml:mrow><mml:mrow><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" id="M199"><mml:mrow><mml:mover accent="true"><mml:mrow><mml:msup><mml:mrow><mml:mi mathvariant="double-struck">R</mml:mi></mml:mrow><mml:mrow><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:msup></mml:mrow><mml:mo>→</mml:mo></mml:mover></mml:mrow></mml:math></inline-formula>

We consider two sets Dc,u and Du which are parts of the spaces R2 and R2, respectively. Dc,u is the disc, in the plane R2, centered at c and is of radius u. Du is the disc in R2 (centered in O). The latter is the set of vectors in R2 having norms at most equal to u.

In comprehension, Dc,u and Du are defined as follows:(10)Dc,u=MR2,M-cu,Du=VR2,Vu.

Suppose that c=cx,cy; then (11)Dc,u=x,yR2,x-cx2+y-cy2u,Du=x,yR2,x2+y2u.

Two points M1 and M2 in the affine plane R2 define a vector denoted as M1M2 or simply M2-M1. We adopt the last notation.

We can state a first property concerning the two parts.

Property 3.

Let M1Dc,u and M2Dc,v. Then M1-M2Du+v.

Proof.

Let M1Dc,u and M2Dc,v and W=M1-M2; let us show that WDu+v. (12)M2-M1=M1M2.We have (13)M1M2M1c+cM2.So M2-M1u+v.

Consequently, WDu+v.

Consider a Bézier curve B of control points P0, P1, P2, and P3 such that PiDc,u. The curve B is of course a subset of Dc,u, since B is located into the convex hull defined by the four control points. This is one of the known properties of Bézier curves. Let us study the disc being able to contain the hodograph (the derivative of B). We can state the following property.

Property 4.

Let B be a Bézier curve of control points P0, P1, P2, and P3 such that PiDc,ui=0,,3. Then we have the following:

BtDc,ut0,1.

BtD6ut0,1.

Proof.

Let H be the hodograph associated with B (HB) of control points h0, h1, and h2.(14)h0=3P1-P0,h1=3P2-P1,h2=3P3-P2.

From Property 3, hiD6u.

So HD6u (H is contained in the convex hull defined through the control points h0, h1, and h2).

In the sequel, we state a property that relates to cross product of a vector in disc Du and another in disc Dv.

Property 5.

Let M1Du and M2Dv; then M1×M2Duv.

Proof.

Let M1Du and M2Dv and W=M1×M2,W=M1·M2·sinθ·k, where θ=M1,M2^.

We have 0M1u and 0M2v.

So 0M1·M2uv.

We get that 0M1·M2·sinθuv.

Consequently, Wuv.

Finally, we have WDuv.

Property 6.

We consider two Bézier curves B1 and B2 such that B1Dc1,u and B2Dc2,u. Let G1 and G2 be the centroids of control points of B1 and B2, respectively. Then we have

B1×B1-G1-B2×B2-G2D24u2

B1×B1-G1-B2×B2-G22576u4

01B1×B1-G1-B2×B2-G22dt576u4.

Proof.

We have B1Dc1,u, G1Dc1,u, B2Dc2,u, and G2Dc2,u.

So B1-G1D2u and B2-G2D2u, got from Property 3.

Also, we have B1D6u and B2D6u from Property 4.

It follows that B1×B1-G1D12u2 and B2×B2-G2D12u2 according to Property 5.

Consequently, we will get B1×B1-G1-B2×B2-G2D24u2.

This point is a direct result of the previous one.

This point is a direct result of the previous one.

Property 7.

Consider two Bézier curves B1 and B2. Let r1 and r2 be radii of the circles associated with B1 and B2. Then, we have(15)011r12B1×B1-G1-1r22B2×B2-G22dt<576.

Proof.

We have B1DG1,r1 and B2DG2,r2.

So (1/r1)B1D(1/r1)G1,1 and (1/r2)B2D(1/r2)G2,1.

Applying Property 6-(3), we get (16)011r1B1×1r1B1-1r1G1-1r2B2×1r2B2-1r2G22dt<576×14u=1.Let (17)011r12B1×B1-G1-1r22B2×B2-G22dt<576.

From this property, we notice that, for all Bézier curves B1 and B2, the value ψB1,B2 would never exceed 576. This allows us to provide the final formula of the way to calculate the similarity between two curves relative to precision close to zero. We thus give the definition of the similarity with respect to a precision ε just after defining S such that(18)SB1,B2=1576011r12B1×B1-G1×B1-1r22B2×B2-G22dt.

Definition 5 (<inline-formula><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" id="M322"><mml:mrow><mml:mi>ε</mml:mi></mml:mrow></mml:math></inline-formula>-similarity).

We consider two cubic Bézier curves B1 and B2. The numbers r1 and r2 represent the radii of the circles associated with these curves. Let G1 and G2 be the centroids of control points of B1 and B2. Then B1 and B2 are ε-similar if and only if

B1 and B2 have the same geometric characterization,

SB1,B2<ε.

5. A Nonlinear Stretching Model Respecting Similarity

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 B of control points P0, P1, P2, and P3 will be simply denoted as B=P0,P1,P2,P3 (in particular, if the Bézier curve is of the first degree, this notation coincides exactly with the one adopted for a line segment).

5.1. Stretching Transformation

Let B1=P10,P11,P12,P13 be a Bézier curve and B2 is the Bézier curve obtained from B1 via affine stretching (it can be linear). Then B2 has the form P20,P21,P22,P23 with the following constraints:

P20=P10.

P23=P13+E:E=w,h; this is the stretching Vector. w and h are stretching amounts in horizontal and vertical directions, respectively.

Let φ be an affine transformation such that φB1=B2. φ is built to be most of the time a nonbalanced homothety or dilation (see next) (otherwise, we will have linear scaling). The matrix M associated with φ and the map I of O are as follows: (19)M=λx00λy,φO=I=Ox,Oy.

Under constraints φP10=P10 and φP13=P13+w,h, knowing that P10=x10,y10 and P13=x13,y13, we will get

λx=1+w/(x13-x10),

λy=1+h/(y13-y10),

Ox=-x10(w/(x13-x10)),

Oy=-y10(h/(y13-y10)).

Here, we notice that if λxλy, then we have an unbalanced dilation or homothety.

φ is an affine mapping. We know that, for every Bézier curve B, B and φB have the same geometric characteristics. What remains is to study the similarity of a curve and its stretched curve by such a transformation.

5.2. The Similarity and the Stretching Vector

To study the relationship between the similarity and the stretching vector w,h,  let us consider the case concerning the stretching of the parenthesis delimiting a mathematical formula. We present the concept for the top part of the left parenthesis only. It will be the same for the bottom part, since the parenthesis has a symmetric shape with respect to a horizontal axis. The study of the stretching of parenthesis reveals the following rule: to any vertical stretching amount h corresponds a horizontal amount w such that w0,h/3. To present the paragraph better, we will give details on the encoding of the top part of the parenthesis. This part of the parenthesis is encoded with two cubic Bézier curves L and R connected by two straight line segments at the top and bottom (see Figure 13). The parenthesis will be shown in 500 body size (half the effective encoding size in the font, 1000 body size). For the study of the relationship between the similarity and the stretching vector, we use only one of the curves, L or R. We choose L to be used. Concretely,(20)L=109.14813,250.00014,109.14813,437.86641,171.58542,625.45052,319.11168,740.27823.

Top part of the left parenthesis.

Some stretchings of L, with h=1200 and w taking values in the set 0,100,200,300,400, are done. However, the display of that in figures is given only in 128 body size so that the illustrations can fit into the page (in body size 128, it is similar to stretch the top part with respect to h=1200(128/1000)=153.6 and w0,12.8,25.6,38.4,51.2). Three of these stretching operations are shown in Figure 14(b), where w=0, w=200, and w=400. The curve in its initial size is in Figure 14(a) to well situate the comparison states.

Different extensions of left curve of the top part of left parenthesis. h is constant; w varies.

Left curve in initial size

Three different horizontal stretchings, 0, 200, 400, for the same vertical amount, h=1200

We can notice that, for a constant amount of the vertical extension h=1200, as the horizontal stretching w increases to h/3, the similarity between the curve and its stretched curve is more and more improved. Samples of this evolution are presented in Table 1.

Variation of the similarity according to w for h=1200.

 h 1200 w 0 100 200 300 400 S 9.22 e - 05 5.79 e - 05 3.21 e - 05 1.43 e - 05 3.86 e - 06

As for horizontal variations, the similarity also loses its quality when h increases. To give an illustration of this fact, some extracts of similarity values for h varying from 0 to 2000 are presented in Table 2. For all values of h, the considered amount of horizontal stretching is w=h/3. We can see that the similarity becomes bad more and more as the value of h increases.

Variation of the similarity according to variation of h and w=h/3.

 h 0 500 100 1500 2000 w 0 166.67 333.33 500 666.67 S 1.11 e - 35 1.92 e - 06 3.44 e - 06 4.37 e - 06 4.98e-06
5.3. Similarity and Bézier Curve Refinement

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 8 and 9) to study the effect of Bézier decomposition on them. Concretely, B1 and B2 are as follows:(21)B1=50,30,57,73,72,110,106,142,B2=50,30,57,83,77,135,111,157.

The value of similarity between these two curves is 8.11526e-7. If we process a multiple Bézier’s decomposition of B1 and B2 and try to compare the similarity between the obtained subcurves of the same decomposition range, we can remark that the values of similarity diminish. Table 3 shows the values of similarity for the multiple decomposition of orders 0, 4, 9, 12, 13, and 19. Generally, from a decomposition of order n, we get n+1 subcurves. Beyond order 13, the similarity of the decomposition segments becomes better than the similarity of the two curves without decomposition

Similarity variation according to Bézier refinement.

n
0 4 9 12 13 19
S 8.12 e - 7 1.64 e - 8 8.22 e - 9 5.63 e - 9 5.02 e - 9 2.79 e - 9
7.24 e - 10 9.67 e - 10 1.37 e - 9 1.41 e - 9 1.27 e - 9
1.73 e - 8 4.11 e - 11 9.31 e - 11 1.57 e - 10 4.37 e - 10
6.18 e - 7 6.06 e - 11 4.15 e - 11 1.59 e - 11 8.40 e - 11
4.01 e - 6 1.04 e - 9 3.19 e - 11 4.95 e - 11 1.86 e - 12
1.71 e - 8 2.01 e - 10 1.60 e - 11 1.74 e - 11
8.66 e - 8 3.43 e - 9 1.05 e - 9 1.90 e - 11
2.81 e - 7 1.72 e - 8 6.83 e - 9 4.13 e - 13
6.99 e - 7 5.49 e - 8 2.44 e - 8 1.18 e - 10
1.42 e - 6 1.37 e - 7 6.52 e - 8 7.89 e - 10
2.91 e - 7 1.45 e - 7 2.78 e - 9
5.43 e - 7 2.84 e - 7 7.27 e - 9
9.04 e - 7 4.97 e - 7 1.59 e - 8
7.93 e - 7 3.10 e - 8
5.53 e - 8
9.20 e - 8
1.44 e - 7
2.15 e - 7
3.05 e - 7
4.14 e - 7

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 A3 is 421. We want to write the half-parenthesis in body 96. What value of h must be used to stretch the half-parenthesis in 1000 body size so that it occupies the half of A3 paper in 96 body size? The value of h should be “3895.13857.” In fact:

H: global height of the stretched half parenthesis in 96 body size. H=421.

b: height of half parenthesis in 1000 body size 1000. b=490.27809.

h: The stretching amount in 1000 body size (to determine).

Then

H=b+h(96/1000) and so h=(1000×H)/96-b.

Let h=3895.13857.

The horizontal amount of stretching adopted to study the effect of decomposition is w=h/3.

We saw in Section 5.1 how to stretch a Bézier curve B with respect to an extension vector w,h. How do we proceed in terms of extension if we decompose the curve B into n Bézier subcurves? Let Bii=0n-1 be the sequence of the obtained curves by multidecomposition (the order of decomposition is n-1).

Let us consider the following items:

B=P0,I,J,Pn: the Bézier curve to decompose and stretch

Bi=Pi,Ii,Ji,Pi+1: the curve segment number i obtained by decomposition, i=0,,n-1

Pi=xi,yi, i=0,,n-1

The curve Bi would be stretched with respect to vector wi,hi, where wi=((xi+1-xi)/(xn-x0))w and hi=((yi+1-yi)/(yn-y0))h. The transformation φi is defined by referring to Section 5.1. Some shift transformations are mandatory to connect the segments after the stretching operations.

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, L and R. In fact, we must stretch L and R of the same vector w,h. As we will see in the following, the simple stretching does not allow a global similarity of the parenthesis. This problem is solved by the Bézier multiple decomposition of the curves L and R. Suppose that we have to perform a decomposition of order n-1 in order to get n Bézier subcurves. Let us consider the following items:

L=PL0,IL,JL,PLn.

Lii=0n-1 is the sequence obtained by the Bézier decomposition of L to order n-1.

R=PR0,IR,JR,PRn

Rii=0n-1 is the sequence obtained by the Bézier decomposition of R to order n-1.

The stretching fractions wi,hi of decomposition segments are determined relative to the curve L and they are used also in the case of R (nothing prevents the reverse). The goal of this is to obtain after extension a parenthesis having the same thickness as the initial one. Let wi,hi=(xL,i+1-xLi/xLn-xL0)w,(yL,i+1-yLi/yLn-yL0)h.

Let Lie and Rie be the curves obtained by stretching of Li and Ri, respectively, according to vector wi,hi. The study of the relationship of Bézier decomposition and similarity is done by measuring the similarity values SLi,Lie and SRi,Rie. Some extracts are in Table 4.

Similarity variation of the shape of the left parenthesis according to Bézier refinement.

n
0 2 4
L R L R L R
S 6.13 e - 06 3.75 e - 07 5.06 e - 07 8.82 e - 09 1.72 e - 07 8.26 e - 09
5.60 e - 07 6.90 e - 09 1.95 e - 07 7.94 e - 10
9.36 e - 08 4.40 e - 09 1.93 e - 07 1.90 e - 09
1.26 e - 07 7.38 e - 09
3.40 e - 09 5.39 e - 10

Moy 6.13 e - 06 3.75 e - 07 3.86 e - 07 6.71 e - 09 1.38 e - 07 3.77 e - 09

The left half parenthesis (to stretch) is given in 96 body size in Figure 15(a). In Figure 15(b), the graphical shape is stretched without any Bézier decomposition. We can notice that, in this case, the delimiting curves on the top part overlap a little bit and therefore the overall similarity is not good. This problem is partially removed in Figure 15(c) and is further improved in Figure 15(d).

Improvement of the global shape similarity according to multirefinement and the same stretching vector w,h=1298.37952,3895.13857.

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 4 shows the evolution of the similarities of the curves obtained by decomposition for the case of the vertical stretching h=3895.13857 and the horizontal one w=1298.37952. For each case, the average of the similarities of the cubic Bézier segments obtained by decomposition is calculated. This average improves as the number of decompositions increases.

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 16(a), 16(b), 17(a), and 17(b), a set of extensible symbols in normal (LA)TEX [12, 13] and their correspondents obtained when using DynMath are presented.

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

6. Conclusions

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.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Lamé G. Leçons sur les Coordonnées Curvilignes et Leurs Diverses Applications 1859 Paris, France Imprimerie de Mallet Bachelier Bayar A. Towards an operational (LA)TEX package supporting optical scaling of dynamic mathematical symbols Proceedings of the TUGboat 2016: The 37th Annual Meeting of the TeX Users Group 2016 Toronto, Canada TUGboat 12 20 Towards an operational (LA)TEX package supporting optical scaling of dynamic mathematical symbols TUGboat Journal 2016 37 2 171 179 Munich M. E. Perona P. Visual identification by signature tracking IEEE Transactions on Pattern Analysis and Machine Intelligence 2003 25 2 200 217 2-s2.0-0037328438 10.1109/TPAMI.2003.1177152 Rath T. M. Manmatha R. Lower-bounding of dynamic time warping distances for multivari- ate time series 2002 Amherst, Mass, USA Center for Intelligent Information Retrieval, University of Massachusetts Amherst Tuzcu V. Nas S. Dynamic time warping as a novel tool in pattern recognition of ECG changes in heart rhythm disturbances Proceedings of the IEEE International Conference on Systems, Man and Cybernetics October 2005 Waikoloa, Hawaii, USA Rabiner L. R. Huang B. H. Fundamentals of Speech Recognition 1993 Prentice Hall Fréchet C. F. Sur quelques points du calcul fonctionnel Rendiconti del Circolo Matematico di Palermo 1906 22 1 1 72 10.1007/BF03018603 JFM37.0348.02 Efrat A. Fan Q. Venkatasubramanian S. Curve matching, time warping, and light fields: new algorithms for computing similarity between curves Journal of Mathematical Imaging and Vision 2007 27 3 203 216 10.1007/s10851-006-0647-0 MR2325848 2-s2.0-34247487834 Bayar A. Sami K. An optimal way to encode the outlines of variable sized arabic letters in a postscript font Proceedings of the 16th International Conference in Central Europe on Computer Graphics, Visualization and Computer Vision 2008 Plzen, Czech Republic University of West Bohemia 57 64 Bayar A. Sami K. Parametric curves variations with respect to a given direction Journal of WSCG 2010 18 1–3 33 40 Knuth D. E. The TeXBook, Computers and Typesetting 1984 A Reading, Mass, USA Addison-Wesley Lamport L. LaTeX-A Document Preparation System 1985 Reading, Mass, USA Addison Wesley