The amplification display method of the raster font based on conversion vector and amplification/display device
Technical field
The present invention relates to a kind of amplification display method of the raster font based on conversion vector and amplification/display device.
Background technology
In some simple, compact portable equipments, it is generally used liquid crystal display screen, so that some are shown by raster font
Machine interactive information., its a line can show the dot matrix Chinese character of 12 16 × 16, often shields taking the liquid crystal display screen of 192 × 64 dot matrix as a example
4 row totally 48 Chinese characters can be shown.Sometimes for facilitating old people to use, need with bigger font display information, such as 20
× 20 dot matrix, such a line can show 8 Chinese characters, often screen display 3 row totally 24 Chinese characters.
In order to realize the amplification of raster font, the method that adopts character library switching in the prior art, for example, using wrapping respectively
Two dot matrix word libraries containing large and small font, only need to switch character library when needing and amplifying font.The method shortcoming is character library
Carrying cost is larger.
In prior art, another kind of method amplifying raster font is by target dot matrix using the algorithm based on floating-point operation
Font is converted to larger raster font, specifically includes following steps:Definition source dot matrix space, according to target dot matrix size respectively
The source dot matrix space of obtaining magnification ratio in the x, y direction, calculates then according to magnification ratio and determines target dot matrix space.The party
Method realizes the amplification of raster font by dot matrix computing, so can save the carrying cost of character library, but does not consider based on not
Operational performance with MPU is pointedly optimized process.In concrete transformation process, the calculation times of magnification ratio are according to target
Depending on font dot matrix size, for example, if target font dot matrix is 20 × 20 dot matrix, 400 in dot matrix point all needs
It is calculated to.So when needing quantity of information to be processed larger, larger operand can be produced.For example for 192 × 64
For dot matrix screen, often screen can show the font of 48 16 × 16 dot matrix, and operand is 400 × 48 times.The MPU of 32 are come
Say, because the arithmetic speed of its own is very fast, double word computing can complete in single command cycle, the font conversion being achieved in for
For dominant frequency is higher than the MPU of 100M, this conversion does not interfere with the experience of user substantially, but occupies too many MPU resource yet, right
For the MPU less than 100M, this conversion still suffers from showing blunt sense.For the MPU of 8, due to its own fortune
Calculation speed is relatively low in addition it is also necessary to extra consumption more MPU clock cycle carry out word/double word computing, and user thus can be made obvious
Feeling that font shows blunt, waiting the time to be shown longer, thus have impact on Consumer's Experience.Further, since magnification ratio
Calculating can produce decimal place choice problem, so according to magnification ratio calculate determine target dot matrix space and realistic objective
Certain deviation can be produced, that is, between the font after causing to amplify and former font, there is some difference, and impact is put between dot matrix space
The aesthetic property that big font shows.
Content of the invention
In view of this, present invention is primarily targeted at providing a kind of amplification of the raster font based on conversion vector to show
Method and amplification/display device, to solve the above problems.
A kind of raster font amplification display method based on conversion vector that the present invention provides, comprises the following steps:
A, acquisition need to amplify the font of display;
B, search the original dot-matrix corresponding to font that above-mentioned needs amplify display in the dot matrix word library prestoring
The dot array data of body;
C, will the x-axis of described original raster font each point, y-axis coordinate move default x-axis, y-axis conversion vector, with to institute
State original raster font dot array data be amplified in x-axis, y-axis convert, thus obtain described need amplify display font
Dot array data;
D, the described dot array data needing amplification display font of output.
It is to calculate, by following process, the vector obtained that described default x-axis, y-axis convert vector:
Target font dot matrix size is removed with raw font dot matrix difference in size with target font dot matrix, obtains segmentation unit long
Degree;
According to described segmentation unit length, target font dot matrix is divided into multiple cut zone;
In each cut zone, obtained long with font dot matrix unit along x-axis, y-axis direction respectively by cycle calculations mode
The vector of degree incremented by successively, and the step-length in this cycle calculations is equal to setting filtration mark on the cut-point of described segmentation unit length
Know.
As seen from the above, said method default conversion vector using original raster font each point when amplifying font comes
Realize the conversion in x-axis, y-axis of original raster font each point, so that when amplifying font without execute instruction cycle phase pair
The longer floating-point operation for calculating conversion ratio and solid point computing, thus during reducing raster font size conversion
Amount of calculation, and then font display speed can be improved, and improve Consumer's Experience.
And determine that by cut zone the conversion vector replacement magnification ratio in raw font dot matrix stretches amplification font,
The decimal place producing because magnification ratio calculates can be avoided to accept or reject, thus avoid empty with realistic objective dot matrix in target dot matrix space
Between between produce deviation, and then solve that between the font after amplification and former font, there is some difference, impact is amplified font and shown
Show the problem of aesthetic property.
In the methods described above, described step B includes:
The font corresponding character code conversion amplifying display is needed to obtain the font that described needs amplify display by described
UNICODE coding, and by this UNICODE coding index in described dot matrix word library described need amplify display font pair
The dot array data of the original raster font answered.
In the methods described above, further comprising the steps of between described step C, D:
For the newly-increased cut-point being provided with filter identification, according to the original neighbouring relations of corresponding point, to newly-increased point according to former
Zag trajectory is accepted or rejected.
As seen from the above, the inventive method can be according to original dot matrix and target dot matrix size, according to Chinese character centrosymmetry
The principle that stretching is amplified, calculates the newly-increased point of the impact font display effect occurring in target font dot matrix, and by new
Increase point and filter reparation, improve the display effect amplifying font.Again because the judgement calculating for this newly-increased point is in conversion
Realize in vectorial calculating process, therefore filter and repair the cycle calculations burden that will not increase that font amplifies display process.
In the methods described above, described step D includes:
The described needs that caching a line or whole screen shows amplify the dot array data of the font showing, to be done to all above-mentioned
After the caching of dot array data, the more all above-mentioned dot array data of caching is exported together.
As seen from the above, the display font dot array data by first showing a line or whole screen caches to relief area, treats
After completing the caching to the dot array data of these display fonts, the more all dot array datas in relief area are exported to liquid crystal display screen
Curtain, can reduce the refreshing frequency of LCD screen, display thus can be made quick and stable, it is to avoid single display font dot array data
The screen flicker being sequentially output and causing, improves Consumer's Experience.
Present invention also offers a kind of raster font amplification/display device, including:
Input module, it is used for obtaining the font needing to amplify display;
Memory module, it is used for storing dot matrix word library and default x-axis, y-axis conversion vector;
Conversion module, it amplifies original corresponding to the font of display for searching above-mentioned needs in described dot matrix word library
The dot array data of raster font, and the x-axis of described original raster font each point, y-axis coordinate are moved described x-axis, y-axis change commutation
Amount, with the dot array data of described original raster font is amplified in x-axis, y-axis convert, thus obtain described need amplify
The dot array data of display font;
Display module, it is used for exporting the described dot array data needing amplification display font.
It is to calculate, by following process, the vector obtained that described default x-axis, y-axis convert vector:
Target font dot matrix size is removed with raw font dot matrix difference in size with target font dot matrix, obtains segmentation unit long
Degree;
According to described segmentation unit length, target font dot matrix is divided into multiple cut zone;
In each cut zone, obtained long with font dot matrix unit along x-axis, y-axis direction respectively by cycle calculations mode
The vector of degree incremented by successively, and the step-length in this cycle calculations is equal to setting filtration mark on the cut-point of described segmentation unit length
Know.
In above-mentioned device, also include:
Filtering module, it is used for filtration reparation and calculates the described dot array data needing amplification display font.
In above-mentioned device, also include:
Cache module, the described needs that it is used for caching a line or whole screen show amplify the dot array data of the font showing.
Brief description
Fig. 1 is the flow chart of the raster font amplification display method based on conversion vector of the present invention;
Fig. 2 is the structure chart of the raster font amplification/display device based on conversion vector of the present invention.
Specific embodiment
Below in conjunction with the accompanying drawings, the amplification that a kind of raster font based on conversion vector of present invention offer is discussed in detail shows
Method and amplification/display device.
The amplification of raster font is based on graphics proportion and amplifies.Chinese character, when small font transforms to big font, keeps profile knot
Structure constant that is to say, that amplify Chinese character when to keep symmetrical above and below about Hanzi structure.
Before implementing the raster font amplification display method that the present invention provides, need to execute an initialization step, including:
It is (X according to prestoring sizing reallys,Ys) dot matrix word library and target font dot matrix (Xt,Yt), that is, amplify font dot matrix
The size in region calculates raw font and amplifies required conversion vector to target font, and concrete calculating process is as follows:
It is assumed that the original raster font prestoring is for 16 × 16 raster fonts taking x-axis conversion vector as a example, target dot matrix
Font is 20 × 20 raster fonts, calculates conversion vector (the i.e. original dot matrix of original raster font each point with reference to following algorithm
Font each point is to the required conversion vector of target raster font conversion):
Δ x=(Xt-Xs)//XtThe x coordinate of target raster font each point, XsThe x coordinate of original raster font each point, Δ x
Change in x-axis for the font stroke distributed areas;
Dt=Xt/ Δ x//different by the way of magnification ratio carries out font amplification from prior art, in the present invention
In, the horizontal partition that sets font unit length dt, insert cut-point, if it is laterally zygomorphic by cut-point, font to be divided into left and right
Dry cut zone.For example, for 20 × 20 raster font, above-mentioned segmentation unit length dt is pressed by this font by cut-point
(x-axis to) is divided into 4 regions in the horizontal.Because font is symmetrical structure amplifying, axisymmetric each side with font
The cut zone being 2 font horizontal partition unit lengths dt including length;
The vectorial calculating process of y-axis conversion of original raster font each point ibid, will not be described here.
As shown in figure 1, being comprised the following steps based on the raster font amplification display method of above-mentioned conversion vector:
Step 100:Obtain the font needing to amplify display.
Step 200:In the dot matrix word library prestoring, search the original raster font corresponding to above-mentioned display font
The dot array data of (i.e. the display font of 16 × 16 dot matrix sizes).
Since it is desired that amplifying the font of display and original raster font is same character of different sizes, therefore it has
Identical character code.So the corresponding original raster font of display font can be indexed according to the character code of this display font
Dot array data.Specifically, corresponding for this display font character code is transformed to the UNICODE coding of this display font,
And the corresponding original raster font of this display font is indexed in above-mentioned dot matrix word library according to the UNICODE coding of display font
Dot array data.For example, for character code is for the display font of UTF8/GBK, using UTF8-UNICODE and
The conversion method of GBK-UNICODE obtains the UNICODE coding of display font, then is encoded by the UNICODE of display font
The dot array data of the corresponding original raster font of display font is indexed in above-mentioned dot matrix word library.Because character code and
UNICODE is converted to techniques known, therefore will not be described here.
Step 300:Using the vectorial dot array data to original raster font of the above-mentioned conversion precomputing in x-axis, y-axis
Enterprising line translation, thus obtain the dot array data of display font.
In this step, the dot array data of the original raster font vector in x-axis, y-axis can be completed using following equation
Conversion:
Mtx[i]:Pt(x, y)=Ms[i]:Ps(tIV[x],y);[0≤x≤xt,0≤y≤ys]
//Mtx[i]:Pt(x,y):Certain point value after the stretching amplification of dot matrix x direction;Ms[i] is the point of original raster font each point
Battle array data;The x-axis conversion vector of each point when tIV [x] converts for Xs-Xt;Ms[i]:Ps(tIV [x], y), in x-axis, will be original
The dot array data M of raster font each pointsThe point of the corresponding tIV [x] of the x coordinate in [i];
Mty[i]:Pt(x, y)=Mtx[i]:Ps(x,tIV(y));[0≤x≤xt,0≤y≤yt]
//Mty[i]:Pt(x,y):Certain point value after the stretching amplification of raster font each point y-axis direction;Mtx[i] is that display font is each
Dot array data after the x-axis stretching of point;TIV [y] is that the y-axis of each point converts vector;Mtx[i]:Ps(x, tIV (y)), on the y axis, will
Dot array data M after x-axis conversiontxThe mobile tIV [y] of y-coordinate in the dot array data of display font each point in [i];
Step 400:Filter the dot array data repairing the display font calculating.
Because in the calculating process of above-mentioned conversion vector, cut-point can be inserted, so as point newly-increased in dot matrix minute
Cutpoint can affect unavoidably, amplify font display, for example, overstriking or darkened amplify font certain a part.Therefore, in display
Need before amplifying font the display font dot array data calculating to be carried out filter to repair.
In this step, find out the point being labeled as " 1 " in above-mentioned conversion vector calculating process by filter vectors fIV, that is,
Newly-increased cut-point, according to the original neighbouring relations of corresponding point, filters to newly-increased point and repairs (accepting or rejecting according to former zag trajectory).Cause
It is that this newly-increased point is judged that calculating is to realize in the vectorial calculating process of conversion, show thus without increasing font amplification
Show the computation burden of process.Wherein, by former zag trajectory cut-off method be known technology, will not be described here.
Step 500:The dot array data of batch signatures display font is for display.
In this step, in order to reduce the refreshing frequency of LCD screen, the display font that can first a line or whole screen be shown
Dot array data caches to relief area, after the caching to the dot array data of these display fonts to be done, then by the institute in relief area
Have dot matrix data output to LCD screen, display thus can be made quick and stable, it is to avoid single display font dot array data according to
Secondary output and the screen flicker that causes.
As shown in Fig. 2 the raster font amplification/display device that the present invention provides includes following part:
Input module 10, it is used for obtaining the font needing display.
Memory module 20, it is used for storing dot matrix word library and default conversion vector.
Conversion module 30, for, in dot matrix word library, searching the point of the original raster font corresponding to above-mentioned display font
Battle array data, using the x-axis of original raster font each point, the vectorial dot array data to original raster font of y-axis conversion in x-axis, y-axis
Enterprising line translation, thus obtain the dot array data of display font.
Filtering module 40, it is used for filtering the dot array data repairing the display font calculating.
Cache module 50, it is used for caching the dot array data of display font in batches.
Display module 60, it is used for the dot array data of output display font.
It is to calculate, by following process, the vector obtained that described default x-axis, y-axis convert vector:
Target font dot matrix size is removed with raw font dot matrix difference in size with target font dot matrix, obtains segmentation unit long
Degree;
According to described segmentation unit length, target font dot matrix is divided into multiple cut zone;
In each cut zone, obtained long with font dot matrix unit along x-axis, y-axis direction respectively by cycle calculations mode
The vector of degree incremented by successively, and the step-length in this cycle calculations is equal to setting filtration mark on the cut-point of described segmentation unit length
Know.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all essences in the present invention
Within god and principle, any modification, equivalent substitution and improvement made etc., should be included within the scope of the present invention.