Content of the invention
In view of this it is necessary to be directed to the problems referred to above, provide mechanical engineering character vector font in a kind of desktop operating system
Body output intent and system, for specific industry, make corresponding font, facilitate the sector librarian use.
To achieve these goals, technical scheme is as follows:
In a kind of desktop operating system, mechanical engineering character vector fonts output intent, comprises the following steps:
S1, abstract process is carried out to mechanical engineering character, according to the feature of the complexity of symbol, conventional property, to corresponding
Character induction and conclusion, is divided into conventional characters and splicing character;
S2, to splicing character take out initial basic element collection, successively according to initial basic element whether can merge with
Meet the less requirement of memory space, algorithm realize character splicing complexity and basic element institute energy range big
Little, determine the basic element collection of final character element;
S3, determine the position in font file for the corresponding basic element, and draw corresponding character element symbol;For commonly used word
Symbol voluntarily selects suitable continuum position with not having regular splicing character, draws character;Complete the system of font file
Make, preserve and install;
S4, judge whether target output character is conventional characters, if conventional characters, then extract corresponding font file simultaneously
Output, if splicing character, then decomposes to target splicing character, determines basic element, select joining method, splice target character
And export.
As preferred, in described step S2, according to encirclement ocra font ocr, upper subscript ocra font ocr, denominator molecule ocra font ocr, answer
It is merged direct type character and conventional characters mechanical engineering character to be split and is extracted basic element.
As preferred, in step s3, described conventional characters include mechanical conventional characters, including roughnessEntirely
BeatCylindricitySymmetry
As preferred, in step s 4, the described joining method surrounding ocra font ocr includes:
Spliced using additive operation, during using circular, square additive operation splicing target character, no matter unit,
Or dibit, before and after character, needs one space of each interpolation, so that character is shown centered in graphical symbol, using positive triangle, fall
During triangle additive operation splicing target character, no matter single, double position, before and after character, need two spaces of each interpolation, make character in figure
It is shown centered in pictograph number.
As preferred, in step s 4, the joining method of described upper subscript ocra font ocr includes:Carried out using additive operation
Splicing;Upper subscript ocra font ocr is divided into subscript to have type, only subscript type and only subscript type three types;
There is ocra font ocr for upper subscript, obtain subscript length and subscript length and mutual relation first, then first export
Radix, exports a character by subscript, and subscript exports the isometric part of subscript on the Sequential output of a character, if subscript length
Less than subscript length, then individually export the remaining part of subscript, if subscript length is equal to subscript length, output character terminates, if
Subscript length is more than subscript length, then press output one character of one subscript, then exports the order in a space, and output is all
Subscript residue character.
As preferred, in step s 4, the joining method of described molecule denominator ocra font ocr includes:First calculate molecule,
The length of denominator, then in molecule denominator, longer string length deducts compared with short character strings length, then round divided by 2 obtain shorter
The initial position that character string is shown centered on;
Export in longer character string, positioned at when being shown centered on the character string before initial position, longer according to output one
Character in character string, then exports the Sequential output of a horizontal line compared with the longer character string before short character strings initial position
Character;
Compared with one of short character strings character, then export the character in longer character string, then export horizontal stroke according to first output
The order of line, until export completely compared with short character strings;
According to a character first exporting remaining character string in longer character string, then export the order of horizontal line, until relatively
Long character string exports completely.
As preferred, in step s 4, for compound splicing ocra font ocr, character string is met using additive operation splicing.
As preferred, in described step S4, also include type described in character element address and character is calculated;Root
According to character locating formula P=(176+H) * 256+161+ (A-48), find it in ASCII character value corresponding in font file
Position, in formula, P represents the position in font file character area, is represented with 10 hex value;176 16 systems are expressed as B0, are
The mark that in font file, Chinese character area starts, the high position that BO encodes for GBK;H represents the weights of character;256 is double word for Chinese character
Section, a high position accounts for a byte;48 is the ASCII character value of " 0 ";A is numeral 0~9 or the capitalization A~Z or little of input
Write the ASCII character value of female a~z.
A kind of according to mechanical engineering character vector fonts output system in the desktop operating system of said method, including data
Library module, character locating module, font make module, character output module;
Described DBM is used for basic element collection, conventional characters and the spcial character element of storage splicing character;
The classification that described character locating module is used for according to belonging to character element determines the ASCII of weights H and character element
Value, and by character locating formula, address in font file for the calculating character element;
Described font makes module and is used for judging that target output character is for conventional characters or to splice character, and target is spliced
Character decomposes, and determines basic element, and splices target character;
Described character output module is used for carrying out output display to splicing character, conventional characters and spcial character element.
Compared with prior art, the beneficial effects of the present invention is:
1st, font directly can export in MSOE, convenient use;
2nd, the font making is easy to organization and management, and when needing corresponding font, installation can use;
3rd, specific industry can be directed to, make corresponding font, facilitate the sector librarian use;
4th, the character exporting in technology document or form, it is clear to print, and quality is high.
Specific embodiment
With reference to the accompanying drawings and examples to mechanical engineering character vector in a kind of desktop operating system of the present invention
Font output intent and system are described further.
The following is mechanical engineering character vector fonts output intent and system in desktop operating system of the present invention
Preferred example, does not therefore limit protection scope of the present invention.
Figures 1 and 2 show that mechanical engineering character vector fonts output intent in a kind of desktop operating system, including following
Step:
S1, abstract process is carried out to mechanical engineering character, according to the feature of the complexity of symbol, conventional property, to corresponding
Character induction and conclusion, is divided into conventional characters and splicing character;
S2, to splicing character take out initial basic element collection, successively according to initial basic element whether can merge with
Meet the less requirement of memory space, algorithm realize character splicing complexity and basic element institute energy range big
Little, determine the basic element collection of final character element;
S3, determine the position in font file for the corresponding basic element, and draw corresponding character element symbol;For commonly used word
Symbol voluntarily selects suitable continuum position with not having regular splicing character, draws character;Complete the system of font file
Make, preserve and install;
S4, judge whether target output character is conventional characters, if conventional characters, then extract corresponding font file simultaneously
Output, if splicing character, then decomposes to target splicing character, determines basic element, select joining method, splice target character
And export.
As preferred, in described step S2, according to encirclement ocra font ocr, upper subscript ocra font ocr, denominator molecule ocra font ocr, answer
It is merged direct type character and conventional characters mechanical engineering character to be split and is extracted basic element.
As preferred, in step s3, described conventional characters include mechanical conventional characters, including roughnessEntirely
BeatCylindricitySymmetry
In the present embodimentDeng surrounding ocra font ocr it is simply that machinery
The character that industry is in daily use, by numeral, other characters such as letter, Chinese character, and graphical symbol composition.For graphical symbol, such asDeng discrete straight line originally can be split as basic element.And adopt the base taking out in this way
This element is although the scope of the special symbol that can splice is wide, but the type and quantity of the most basic element that can make increase severely, and increases
Big memory space, increases the difficulty of splicing.If by pictureEtc. simple symbol, as a basic element, can significantly
Reduce the memory space of character, and be easy to splice, and not occupy-place (before light is marked on graphical symbol) during the output of this kind of graphical symbol.
Unit refers to containing only a character in graphical symbol, and dibit refers to contain two characters in graphical symbol.
Surround ocra font ocr and target character be can get using " addition " computing splicing, as follows:
During using circular (Pian Zhongqu), square (Pian Zhongqu) " addition " computing splicing target character, no matter unit or
Dibit, before and after character, needs one space of each interpolation, so that character is shown centered in graphical symbol.As follows:
(character n belongs to partially middle unit character)
(character A belongs to partially middle dibit character)
(character d belongs to partially middle unit character)
(character a, B belong to partially middle dibit character)
During using positive triangle (area on the lower side), inverted triangle (area on the upper side) " addition " computing splicing target character, no matter single, double
Position, before and after character, needs two spaces of each interpolation, so that character is shown centered in graphical symbol.As follows:
(character M belongs to unit character on the upper side)
(character A, 1 belong to dibit on the lower side
Character)
In the present embodiment,7+0.452、5-0.291Deng upper subscript ocra font ocr, it is divided into subscript to have type, only have
Subscript type and only subscript type three types.This kind of character is in component of machine form, drawing, very common, by numeral,
Plus, minus sign and point composition, basic element is simpler, during output, subscript not occupy-place, subscript occupy-place.Also " addition " computing can be adopted,
As follows:
1) upper subscript has type, such asDuring " addition " computing, program obtains subscript length and subscript length first
And mutual relation, then first export radix 4, export a character by subscript, the Sequential output that subscript exports a character is upper and lower
Mark isometric part, then:
If a) subscript length is less than subscript length, individually export the remaining part of subscript.
If b) subscript length is equal to subscript length, output character terminates.
If c) subscript length is more than subscript length, by output one character of one subscript, then export a space
Sequentially, output all subscripts residue character.
2) only have subscript type, such as 5-0.291.Then first export radix 5, then export all subscript characters in order.
3) only have subscript type, such as 7+0.452.Then first export radix 7, then press one superscript character(SPS) of output, export a sky
The order of lattice, until export all superscript character(SPS)s.
In the present embodiment, molecule denominator ocra font ocr, such asDeng being conventional character.By
Upper and lower case letter, numeral and horizontal line-composition basic element, when entering line character splicing " addition " computing, molecule character and denominator
Character not occupy-place, but horizontal line occupy-place.During character output display, program calculates the length of molecule, denominator first, and then molecule divides
In mother, longer string length deducts compared with short character strings length, then round divided by 2 obtain initial compared with what short character strings were shown centered on
Position, then:
1) export in longer character string, positioned at when being shown centered on the character string before initial position, according to output one relatively
Character in long character string, then exports the Sequential output of a horizontal line compared with the longer character string before short character strings initial position
In character.
2) compared with one of short character strings character, then export the character in longer character string, then export according to first output
The order of horizontal line, until export completely compared with short character strings.
3) according to a character first exporting remaining character string in longer character string, then export the order of horizontal line, until
Longer character string exports completely.
In the present embodiment, precomposed character splice type, such asAnd Tolerance Symbols in Shape and Relative Position etc., for machinery
Drawing, byDeng composite component and Etc. morpheme
Symbol and Chinese character, letter composition.Composite component not occupy-place, morpheme symbol, Chinese character, letter all occupy-places, also adopt " addition " computing
Splicing precomposed character string, as follows:
(special symbol, circle not occupy-place, square occupy-place.)
In the present embodiment, conventional characters, such asIso-scallop symbol, Deng mechanical special symbol,Deng the symbol of customization symbol and other forms, need not splice, directly
Use, very easy, efficiently.
As shown in Fig. 2 superscript notation in font file, subfix, single dibit symbol on the upper side, partially middle single dibit symbol,
English alphabet and the digit symbols such as single dibit symbol on the lower side, are all regular symbols, and need and justify, square, positive three
The graphical symbols such as angle, lower triangle are combined.In order to realize efficient character stitching algorithm it is desirable to be able to use this English alphabet
Find its corresponding position in font file with the ASCII character value of numerical character itself, provide a character locating here
Formula (can deform to this formula to meet particular demands) as needed:
P=(176+H) * 256+161+ (A-48)
In formula:
P:P represents the position in font file character area, is represented with 10 hex value.As font file GBK encodes B1A1
Position represented by (16 system), decimal representation is 45473.
176:176 16 systems are expressed as B0, and this is the mark that in font file, Chinese character area starts, and BO encodes for GBK
A high position, such as first Chinese character " " in Chinese character area, corresponding position is B0A1.
H:Weights, the value being manually set according to character feature, the weights of kinds of characters are as follows:
Superscript character(SPS):1;
Subscript character:2;
Unit character on the upper side:3;
Dibit character on the upper side:4;
Partially middle unit character:5;
Partially middle dibit character:6;
Unit character on the lower side:7;
Dibit character on the lower side:8;
256:Chinese character is double byte, and a high position accounts for a byte, and that is, 28 powers, are 256.
161:For side-play amount, B000~B0A1 is 161 clear areas.
A:The numeral 0~9 of input or the ASCII character value of capitalization A~Z or lower case a~z, such as input " A
ASCII character value 64.
48:For the ASCII character value of " 0 ", why so arrange, be because 0~9, capitalization A~Z, lower case a
ASCII character value corresponding to~z be one relatively continuous region (0~9 with separated 7 of A~Z, A~Z and a~z it
Separated 6), the ASCII character value of small letter z is 122 to the maximum, and deducting 48 is 74.96 positions are had between B0 to B1, so will not
Go beyond the scope, and 0~9, A~Z, a~z also can in font file coding region relatively continuous position.
As shown in Figures 3 to 5, in the present embodiment, additionally provide a kind of according to machine in the desktop operating system of said method
Tool engineering character vector fonts output system, makes module, character output including DBM, character locating module, font
Module;
Described DBM is used for basic element collection, conventional characters and the spcial character element of storage splicing character;
The classification that described character locating module is used for according to belonging to character element determines the ASCII of weights H and character element
Value, and by character locating formula, address in font file for the calculating character element;
Described font makes module and is used for judging that target output character is for conventional characters or to splice character, and target is spliced
Character decomposes, and determines basic element, and splices target character;
Described character output module is used for carrying out output display to splicing character, conventional characters and spcial character element.
As shown in figure 5, the mainly comprising the following steps of character output module:
1st, judge whether target output character is conventional characters, if conventional characters, enter character locating module, execute step
Rapid 3.
2nd, target splicing character is decomposed, determine basic element, enter character locating module, it is then determined that target splicing word
The type of symbol.
1) if surrounding ocra font ocr, further determine which belongs in area on the upper side character, Pian Zhong area character and area on the lower side character
One class.According to belonging to target splices basic element, the character element address of character locating module output and the character that character decomposes
The stitching algorithm in area, splices target character.
2) if upper subscript ocra font ocr, further determine that belonging to subscript has type, only have subscript type, where only have subscript type
One class.According to belonging to target splices basic element, the character element address of character locating module output and the character that character decomposes
The stitching algorithm of type, splices target character.
3) if molecule denominator ocra font ocr, basic element, the molecule denominator ocra font ocr that character decomposes is spliced according to target
Output rule and the character element address of character locating module output, splice target character.
4) if compound splicing ocra font ocr, splice the basic element of character according to target, in conjunction with basic in font file
Characteristic element and the character element address of character locating module output, select suitable joining method (not unique), quick, efficiently
Splicing target character.
Compared with prior art, the beneficial effects of the present invention is:
1st, font directly can export in MSOE, convenient use;
2nd, the font making is easy to organization and management, and when needing corresponding font, installation can use;
3rd, specific industry can be directed to, make corresponding font, facilitate the sector librarian use;
4th, the character exporting in technology document or form, it is clear to print, and quality is high.
Embodiment described above only have expressed the several embodiments of the present invention, and its description is more concrete and detailed, but simultaneously
Therefore the restriction to the scope of the claims of the present invention can not be interpreted as.It should be pointed out that for those of ordinary skill in the art
For, without departing from the inventive concept of the premise, some deformation can also be made and improve, these broadly fall into the guarantor of the present invention
Shield scope.Therefore, the protection domain of patent of the present invention should be defined by claims.