Summary of the invention
The present invention is based on the problems referred to above, it is proposed that a kind of new technical scheme, it is possible to the character library needing generation low capacity according to user, removes the redundancy word taken less than in a large number, thus optimizing webpage loading velocity.
In view of this, the present invention proposes a kind of word library generating method, including: according to the setting command received or default font info file, character library is set and generates request data; Generate request data according to described character library, it is determined that original character library, and extract target character library in described original character library.
In this technical scheme, user can carry out online font setting according to demands of individuals, setting option includes fontname and webpage domain name, and the font info file of this user-specific is generated according to the fontname arranged and webpage domain name, these font info file preset are generally JS (JavaScirpt, formula script of literal translating) file.It addition, when the fontname of user setup and webpage domain name occur to update, font info file also updates therewith. When user needs to obtain the character library simplified, name and the webpage domain name etc. of can directly setting font character library generates request data, default font info file can also be read in systems, directly obtain the contents such as the fontname arranged and webpage domain name, and generate request data according to the character library arranged, corresponding original character library being cut out or the operation such as extraction, thus obtaining target data, namely the target data obtained adapts to the character library after the simplifying of user's needs. By this technical scheme, it is possible to the character library needing generation low capacity according to user, removing the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, promoting the experience of user.
In technique scheme, preferably, setting command that described basis receives or default font info file, character library is set and generates request data, specifically include: according to the described setting command received, ID for sending described setting command arranges webpage domain name, fontname and text data, and described text data is carried out duplicate removal, or according to default described font info file, obtain the described webpage domain name of described webpage, described fontname and described text data when accessing webpage, and described text data is carried out duplicate removal; And according to the described text data after described webpage domain name, described fontname and duplicate removal, generate encrypted characters string the type of the browser according to described webpage according to predetermined encryption rule, it is determined that the type of required described target character library.
In this technical scheme, when user needs to obtain the character library simplified, directly can be set font name, webpage domain name and text data, it is also possible to reads default font info file in systems, directly obtains the fontname, webpage domain name and the text data that arranged. After obtaining fontname, webpage domain name and text data, further text data is carried out deduplication operation, to delete repetition data therein.
In this technical scheme, encrypted characters string can also be generated according to the text data after ID, fontname, webpage domain name and duplicate removal, such as, font needed for user foundertest be called upright quiet flower bud simplified time, the content of text " university of BeiJing, China " after this font duplicate removal in English name FZJLJW according to this font and webpage, it is possible to generate encrypted characters string 6ab591e473ce55fd05b0732b5aab6821.
Additionally, in this technical scheme, the type of required target character library can also be determined according to the type of the browser of webpage, wherein, the type of target character library includes TTF (TrueTypeFont), EOT, WOFF (WebOpenFontFormat, the open font format of webpage), SVG (ScalableVectorGraphics, scalable vector graphics) etc., such as, when the webpage that webpage is IE browser opened, it may be determined that the type of target character library is EOT.
In technique scheme, it is preferable that described character library generates request data and includes the type of described ID, domain name, described fontname, described encrypted characters string and required described target character library.
In technique scheme, it is preferable that extract before described target character library in described original character library, also include: according to default described font info file, it is determined that described character library generates whether request data meets predetermined verification rule;When determining that described character library generation request data meets described predetermined verification rule, it is allowed to extract described target character library in described original character library.
In this technical scheme, before extracting target character library, it is necessary to the authority extracting target character library is verified, such as, it is judged that whether the ID of user exists in system, if this ID is absent from, then stops data and process, do not generate the character library simplified for this user. For another example, it is judged that whether system stores current domain name, if system does not store current domain name, then stop data and process, do not generate the character library simplified for this user. Pass through the technical program so that system can be only specific user or can only carry out simplifying of character library according to particular data, it is possible to avoids illegal request, it is simple to put goods on the market, it is also possible to avoid malicious requests, protects the safety of data.
In technique scheme, it is preferable that described extract target character library in described original character library, specifically include: in described original character library, determine GLYPH (tag mark) font of described text data; Extract the described GLYPH font of described text data or delete the described GLYPH font beyond described text data, to generate described target character library.
In this technical scheme, it is possible to the GLYPH font in original character library is cut out or is extracted, to generate the less target character library more simplified of capacity, thus removing the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, promote the experience of user.
In technique scheme, it is preferable that also include: according to described type, the described target character library generated is compressed, to obtain the described target character library of required described type.
In this technical scheme, target character library can be compressed into the types such as TTF (TrueTypeFont), EOT, WOFF, SVG, for EOT type, after the character library that the compression of target character library is generated required EOT type, the file storage structure of the character library after compression is identical with former target character library with name, and simply file format is different. By target character library is compressed, it is possible to obtain the target character library of multiple format, thus having widened the scope of application of the character library after simplifying.
In technique scheme, preferably, also include: store described font info file, described encrypted characters string and described target character library, for when the described encrypted characters string again generated is identical with the described encrypted characters string of storage, the described target character library that the described encrypted characters string that calls and store is corresponding, and the content of described target character library is write described webpage with the form of CSS code.
In this technical scheme, font info file, encrypted characters string and target character library etc. are stored, when again carrying out character library and simplifying, if the encrypted characters string generated is identical with the encrypted characters string of storage, then directly invoke the target character library of the corresponding types of storage, without the generation work again carrying out target character library, optimize the speed that webpage loads, be greatly improved Consumer's Experience.
Another aspect of the present invention proposes a kind of character library and generates system, including: unit is set, according to the setting command received or default font info file, character library is set and generates request data; Processing unit, generates request data according to described character library, it is determined that original character library, and extracts target character library in described original character library.
In this technical scheme, user can carry out online font setting according to demands of individuals, setting option includes fontname and webpage domain name, and the font info file of this user-specific is generated according to the fontname arranged and webpage domain name, these font info file preset are generally JS (JavaScirpt, formula script of literal translating) file.It addition, when the fontname of user setup and webpage domain name occur to update, font info file also updates therewith. When user needs to obtain the character library simplified, name and the webpage domain name etc. of can directly setting font character library generates request data, default font info file can also be read in systems, directly obtain the contents such as the fontname arranged and webpage domain name, and generate request data according to the character library arranged, corresponding original character library being cut out or the operation such as extraction, thus obtaining target data, namely the target data obtained adapts to the character library after the simplifying of user's needs. By this technical scheme, it is possible to the character library needing generation low capacity according to user, removing the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, promoting the experience of user.
In technique scheme, preferably, described arrange unit for: according to the described setting command received, ID for sending described setting command arranges webpage domain name, fontname and text data, and described text data is carried out duplicate removal, or according to default described font info file, obtain the described webpage domain name of described webpage, described fontname and described text data when accessing webpage, and described text data is carried out duplicate removal; And the described unit that arranges also includes: character string determines unit, according to the described text data after described webpage domain name, described fontname and duplicate removal, generate encrypted characters string according to predetermined encryption rule; Type determining units, the type according to the browser of described webpage, it is determined that the type of required described target character library.
In this technical scheme, when user needs to obtain the character library simplified, directly can be set font name, webpage domain name and text data, it is also possible to reads default font info file in systems, directly obtains the fontname, webpage domain name and the text data that arranged. After obtaining fontname, webpage domain name and text data, further text data is carried out deduplication operation, to delete repetition data therein.
In this technical scheme, encrypted characters string can also be generated according to the text data after ID, fontname, webpage domain name and duplicate removal, such as, font needed for user foundertest be called upright quiet flower bud simplified time, the content of text " university of BeiJing, China " after this font duplicate removal in English name FZJLJW according to this font and webpage, it is possible to generate encrypted characters string 6ab591e473ce55fd05b0732b5aab6821.
Additionally, in this technical scheme, the type of required target character library can also be determined according to the type of the browser of webpage, wherein, the type of target character library includes TTF (TrueTypeFont), EOT, WOFF, SVG etc., such as, when the webpage that webpage is IE browser opened, it may be determined that the type of target character library is EOT.
In technique scheme, it is preferable that described character library generates request data and includes the type of described ID, domain name, described fontname, described encrypted characters string and required described target character library; And described character library generates system and also comprises determining that unit, described in original character library, extract target character library before, according to default described font info file, determine that described character library generates whether request data meets predetermined verification rule, and when determining that described character library generation request data meets described predetermined verification rule, it is allowed in described original character library, extract described target character library.
In this technical scheme, before extracting target character library, it is necessary to the authority extracting target character library is verified, such as, it is judged that whether the ID of user exists in system, if this ID is absent from, then stops data and process, do not generate the character library simplified for this user. For another example, it is judged that whether system stores current domain name, if system does not store current domain name, then stop data and process, do not generate the character library simplified for this user. Pass through the technical program so that system can be only specific user or can only carry out simplifying of character library according to particular data, it is possible to avoids illegal request, it is simple to put goods on the market, it is also possible to avoid malicious requests, protects the safety of data.
In technique scheme, preferably, described processing unit is used for: determines the GLYPH font of described text data in described original character library, and extracts the described GLYPH font of described text data or delete the described GLYPH font beyond described text data, to generate described target character library.
In this technical scheme, it is possible to the GLYPH font in original character library is cut out or is extracted, to generate the less target character library more simplified of capacity, thus removing the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, promote the experience of user.
In technique scheme, it is preferable that also include: compression unit, according to described type, the described target character library generated is compressed, to obtain the described target character library of required described type.
In this technical scheme, target character library can be compressed into the types such as TTF (TrueTypeFont), EOT, WOFF, SVG, for EOT type, after the character library that the compression of target character library is generated required EOT type, the file storage structure of the character library after compression is identical with former target character library with name, and simply file format is different. By target character library is compressed, it is possible to obtain the target character library of multiple format, thus having widened the scope of application of the character library after simplifying.
In technique scheme, preferably, also include: memory element, store described font info file, described encrypted characters string and described target character library, for when the described encrypted characters string again generated is identical with the described encrypted characters string of storage, the described target character library that the described encrypted characters string that calls and store is corresponding, and the content of described target character library is write described webpage with the form of CSS code.
In this technical scheme, font info file, encrypted characters string and target character library etc. are stored, when again carrying out character library and simplifying, if the encrypted characters string generated is identical with the encrypted characters string of storage, then directly invoke the target character library of the corresponding types of storage, without the generation work again carrying out target character library, optimize the speed that webpage loads, be greatly improved Consumer's Experience.
Another aspect of the invention proposes a kind of server, includes the character library described in technique scheme and generates system. Therefore, this server has whole beneficial effects of the character library generation system that technique scheme provides, and does not repeat them here.
By above technical scheme, request data can be generated according to the character library of user setup, corresponding original character library is cut out or extraction etc. operates, the character library of the low capacity after being simplified, eliminate the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, improve the experience of user.
Detailed description of the invention
In order to be more clearly understood that the above-mentioned purpose of the present invention, feature and advantage, below in conjunction with the drawings and specific embodiments, the present invention is further described in detail. It should be noted that when not conflicting, embodiments herein and the feature in embodiment can be mutually combined.
Elaborate a lot of detail in the following description so that fully understanding the present invention; but; the present invention can also adopt other to be different from other modes described here to implement, and therefore, protection scope of the present invention is by the restriction of following public specific embodiment.
Fig. 1 illustrates the flow chart of word library generating method according to an embodiment of the invention.
As it is shown in figure 1, word library generating method according to an embodiment of the invention, including:
Step 102, according to the setting command received or default font info file, arranges character library and generates request data.
Step 104, generates request data according to character library, it is determined that original character library, and extracts target character library in original character library.
In this technical scheme, user can carry out online font setting according to demands of individuals, setting option includes fontname and webpage domain name, and the font info file of this user-specific is generated according to the fontname arranged and webpage domain name, these font info file preset are generally JS (JavaScirpt, formula script of literal translating) file. It addition, when the fontname of user setup and webpage domain name occur to update, font info file also updates therewith. When user needs to obtain the character library simplified, name and the webpage domain name etc. of can directly setting font character library generates request data, default font info file can also be read in systems, directly obtain the contents such as the fontname arranged and webpage domain name, and generate request data according to the character library arranged, corresponding original character library being cut out or the operation such as extraction, thus obtaining target data, namely the target data obtained adapts to the character library after the simplifying of user's needs. By this technical scheme, it is possible to the character library needing generation low capacity according to user, removing the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, promoting the experience of user.
In technique scheme, preferably, step 102 specifically includes: according to the setting command received, ID for sending setting command arranges webpage domain name, fontname and text data, and text data is carried out duplicate removal, or according to default font info file, obtain the webpage domain name of webpage, fontname and text data when accessing webpage, and text data is carried out duplicate removal; And according to the text data after webpage domain name, fontname and duplicate removal, generate encrypted characters string the type of the browser according to webpage according to predetermined encryption rule, it is determined that the type of required target character library.
In this technical scheme, when user needs to obtain the character library simplified, directly can be set font name, webpage domain name and text data, it is also possible to reads default font info file in systems, directly obtains the fontname, webpage domain name and the text data that arranged.After obtaining fontname, webpage domain name and text data, further text data is carried out deduplication operation, to delete repetition data therein.
In this technical scheme, encrypted characters string can also be generated according to the text data after ID, fontname, webpage domain name and duplicate removal, such as, font needed for user foundertest be called upright quiet flower bud simplified time, the content of text " university of BeiJing, China " after this font duplicate removal in English name FZJLJW according to this font and webpage, it is possible to generate encrypted characters string 6ab591e473ce55fd05b0732b5aab6821.
Additionally, in this technical scheme, the type of required target character library can also be determined according to the type of the browser of webpage, wherein, the type of target character library includes TTF (TrueTypeFont), EOT, WOFF, SVG etc., such as, when the webpage that webpage is IE browser opened, it may be determined that the type of target character library is EOT.
In technique scheme, it is preferable that character library generates request data and includes the type of ID, domain name, fontname, encrypted characters string and required target character library.
In technique scheme, it is preferable that before step 104, also include: according to default font info file, it is determined that character library generates whether request data meets predetermined verification rule; When determining that character library generation request data meets predetermined verification rule, it is allowed to extraction target character library in original character library.
In this technical scheme, before extracting target character library, it is necessary to the authority extracting target character library is verified, such as, it is judged that whether the ID of user exists in system, if this ID is absent from, then stops data and process, do not generate the character library simplified for this user. For another example, it is judged that whether system stores current domain name, if system does not store current domain name, then stop data and process, do not generate the character library simplified for this user. Pass through the technical program so that system can be only specific user or can only carry out simplifying of character library according to particular data, it is possible to avoids illegal request, it is simple to put goods on the market, it is also possible to avoid malicious requests, protects the safety of data.
In technique scheme, it is preferable that step 104 specifically includes: determine the GLYPH font of text data in original character library; Extract the GLYPH font of text data or delete the GLYPH font beyond text data, to generate target character library.
In this technical scheme, it is possible to the GLYPH font in original character library is cut out or is extracted, to generate the less target character library more simplified of capacity, thus removing the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, promote the experience of user.
In technique scheme, it is preferable that also include: according to type, the target character library generated is compressed, to obtain the target character library of required type.
In this technical scheme, target character library can be compressed into the types such as TTF (TrueTypeFont), EOT, WOFF, SVG, for EOT type, after the character library that the compression of target character library is generated required EOT type, the file storage structure of the character library after compression is identical with former target character library with name, and simply file format is different. By target character library is compressed, it is possible to obtain the target character library of multiple format, thus having widened the scope of application of the character library after simplifying.
In technique scheme, preferably, also include: storage font info file, encrypted characters string and target character library, for when the encrypted characters string again generated is identical with the encrypted characters string of storage, the target character library that the encrypted characters string that calls and store is corresponding, and the content of target character library is write webpage with the form of CSS code.
In this technical scheme, font info file, encrypted characters string and target character library etc. are stored, when again carrying out character library and simplifying, if the encrypted characters string generated is identical with the encrypted characters string of storage, then directly invoke the target character library of the corresponding types of storage, without the generation work again carrying out target character library, optimize the speed that webpage loads, be greatly improved Consumer's Experience.
Fig. 2 illustrates that character library according to an embodiment of the invention generates the block diagram of system.
As in figure 2 it is shown, character library according to an embodiment of the invention generates system 200, including: unit 202 is set, according to the setting command received or default font info file, character library is set and generates request data; Processing unit 204, generates request data according to character library, it is determined that original character library, and extracts target character library in original character library.
In this technical scheme, user can carry out online font setting according to demands of individuals, setting option includes fontname and webpage domain name, and the font info file of this user-specific is generated according to the fontname arranged and webpage domain name, these font info file preset are generally JS (JavaScirpt, formula script of literal translating) file. It addition, when the fontname of user setup and webpage domain name occur to update, font info file also updates therewith. When user needs to obtain the character library simplified, name and the webpage domain name etc. of can directly setting font character library generates request data, default font info file can also be read in systems, directly obtain the contents such as the fontname arranged and webpage domain name, and generate request data according to the character library arranged, corresponding original character library being cut out or the operation such as extraction, thus obtaining target data, namely the target data obtained adapts to the character library after the simplifying of user's needs. By this technical scheme, it is possible to the character library needing generation low capacity according to user, removing the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, promoting the experience of user.
In technique scheme, preferably, arrange unit 202 for: according to the setting command received, ID for sending setting command arranges webpage domain name, fontname and text data, and text data is carried out duplicate removal, or according to default font info file, obtain the webpage domain name of webpage, fontname and text data when accessing webpage, and text data is carried out duplicate removal; And unit 202 is set also includes: character string determines unit 2022, according to the text data after webpage domain name, fontname and duplicate removal, generates encrypted characters string according to predetermined encryption rule; Type determining units 2024, the type according to the browser of webpage, it is determined that the type of required target character library.
In this technical scheme, when user needs to obtain the character library simplified, directly can be set font name, webpage domain name and text data, it is also possible to reads default font info file in systems, directly obtains the fontname, webpage domain name and the text data that arranged. After obtaining fontname, webpage domain name and text data, further text data is carried out deduplication operation, to delete repetition data therein.
In this technical scheme, encrypted characters string can also be generated according to the text data after ID, fontname, webpage domain name and duplicate removal, such as, font needed for user foundertest be called upright quiet flower bud simplified time, the content of text " university of BeiJing, China " after this font duplicate removal in English name FZJLJW according to this font and webpage, it is possible to generate encrypted characters string 6ab591e473ce55fd05b0732b5aab6821.
Additionally, in this technical scheme, the type of required target character library can also be determined according to the type of the browser of webpage, wherein, the type of target character library includes TTF (TrueTypeFont), EOT, WOFF, SVG etc., such as, when the webpage that webpage is IE browser opened, it may be determined that the type of target character library is EOT.
In technique scheme, it is preferable that character library generates request data and includes the type of ID, domain name, fontname, encrypted characters string and required target character library; And character library generates system 200 and also comprises determining that unit 206, before extracting target character library in original character library, according to default font info file, determine that character library generates whether request data meets predetermined verification rule, and when determining that character library generation request data meets predetermined verification rule, it is allowed to extraction target character library in original character library.
In this technical scheme, before extracting target character library, it is necessary to the authority extracting target character library is verified, such as, it is judged that whether the ID of user exists in system, if this ID is absent from, then stops data and process, do not generate the character library simplified for this user. For another example, it is judged that whether system stores current domain name, if system does not store current domain name, then stop data and process, do not generate the character library simplified for this user. Pass through the technical program so that system can be only specific user or can only carry out simplifying of character library according to particular data, it is possible to avoids illegal request, it is simple to put goods on the market, it is also possible to avoid malicious requests, protects the safety of data.
In technique scheme, it is preferable that processing unit 204 is used for: determine the GLYPH font of text data in original character library, and extract the GLYPH font of text data or delete the GLYPH font beyond text data, to generate target character library.
In this technical scheme, it is possible to the GLYPH font in original character library is cut out or is extracted, to generate the less target character library more simplified of capacity, thus removing the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, promote the experience of user.
In technique scheme, it is preferable that also include: compression unit 208, according to type, the target character library generated is compressed, to obtain the target character library of required type.
In this technical scheme, target character library can be compressed into the types such as TTF (TrueTypeFont), EOT, WOFF, SVG, for EOT type, after the character library that the compression of target character library is generated required EOT type, the file storage structure of the character library after compression is identical with former target character library with name, and simply file format is different. By target character library is compressed, it is possible to obtain the target character library of multiple format, thus having widened the scope of application of the character library after simplifying.
In technique scheme, preferably, also include: memory element 210, storage font info file, encrypted characters string and target character library, for when the encrypted characters string again generated is identical with the encrypted characters string of storage, the target character library that the encrypted characters string that calls and store is corresponding, and the content of target character library is write webpage with the form of CSS code.
In this technical scheme, font info file, encrypted characters string and target character library etc. are stored, when again carrying out character library and simplifying, if the encrypted characters string generated is identical with the encrypted characters string of storage, then directly invoke the target character library of the corresponding types of storage, without the generation work again carrying out target character library, optimize the speed that webpage loads, be greatly improved Consumer's Experience.
Fig. 3 illustrates that character library according to another embodiment of the invention generates the block diagram of system.
As it is shown on figure 3, character library according to another embodiment of the invention generates system 300, including:
User setup module 302, in user setup module 302, can according to the demands of individuals of user, carry out online font setting, setting option therein includes fontname and webpage domain name, after setting completed, can be saved in character library generation system 300 by arranging result, and the JS file according to the data genaration user-specific arranged, and JS file is preserved to character library generation system 300.
Request data acquisition module 304, a complete request data includes the content of text after ID, webpage domain name, font English name and duplicate removal, and the mode obtaining request data has two kinds: User Defined mode and system obtain mode automatically.
Request sends module 306, when selecting User Defined mode, as long as getting complete request data, just directly send this request to server, and send whole request data, and when selecting system automatically to obtain the mode of asking, if getting a plurality of partial data, then circulation sends request, and sends whole request data.
Request processing module 308, comprising: data check submodule, judge submodule, extract simplify small library submodule, cutting submodule, extract submodule and compression submodule. In request processing module 308, first being made requests on the verification of data by data check submodule, if verifying unsuccessfully, then abort request processes and returns failed message, if by verifying, entering and judge submodule; Judge submodule, it is judged that whether this request data has the right to be processed and should enter which module further processes further; When judged result is for being, extraction is simplified small library module and is generated simplified TTF character library by cutting submodule or extraction submodule, and compression submodule will be simplified TTF character library and is converted to various online font format, when judged result is no, return failed message, and record failed message.
Returning data module 310, finally, character library generates system 300 all will write data into the page with CSS code form, so, even if developer does not possess the knowledge relevant to the font-face of CSS3, it is possible to use online font.
User data memory module 312, the user data of storage includes the JS file of user-specific, user uses all simplify small library and various online font format simplify small library.
In technique scheme, it is preferable that the fontname of the setting option in user setup module 302 is the Chinese of Chinese word library when presenting to user, and take from the word-base data record of character library generation system 300; The domain name of setting option is apply the domain name of online font, and comprises URL (UniformResourceLocator, URL) protocol section, for instance, http://www.foundertype.com.
In technique scheme, preferably, in user setup module 302, all of record arrange data, its fontname and domain name are all man-to-man relations, say, that a data is made up of ID, fontname and domain name, these three have association uniqueness, so the subsequent expansion of character library generation system 300 is easy in storage, and wherein, the set-up mode of user can change flexibly.
In technique scheme, preferably, according to the JS file arranging data and can generating user-specific in user setup module 302, contain all process logics of JS mode method of calling and user in JS file and corresponding online font arranged data, the content of JS file changes with the change of user setup, and each user has exclusive JS file, the link all using same JS file in the webpage that system 300 provides online font to service is generated in all application character libraries, therefore, the additions and deletions of application font are arranged, only need to generate in system 300 in character library and carry out, character library generates system 300 can will arrange the data syn-chronization JS file to user-specific automatically.
In technique scheme, it is preferable that for User Defined mode, generally actively sent request by user, and except ID, other data in request data are user according to request rule from main separation or self-defined submission.
In technique scheme, preferably, system is obtained automatically to mode, the page setup that request data is all generated setting system 300 in and user according to user in character library by system automatically obtains, character library generates system 300 and generates in character library based on user and arrange data in system 300, obtain webpage domain name, and filter out the spendable online font of user according to webpage domain name, then in webpage, match content of text corresponding with this online font, to text content duplicate removal, and generate encrypted characters string by predetermined encryption rule, and can also according to the browser type of webpage, determine the online font format of needs, such as TTF, EOT, WOFF, SVG etc. if it addition, character library generates system 300 matches the online font of many moneys, then a plurality of request data can be generated.
In technique scheme, it is preferable that system is obtained automatically to mode, character library generates system 300 and according to the processing module in request processing module 308, can send difference respectively and ask summed data, it is intended to reduce data traffic and improve processing speed.
In technique scheme, it is preferable that data check submodule is mainly used in judging whether the data of each request meet predetermined verification rule, it is to avoid illegal request and malicious requests, it is ensured that data safety. If checking unsuccessfully, then abort request processes and returns failed message, if verifying successfully, entering and judging submodule.
In technique scheme, it is preferable that, it is judged that whether submodule judges for authority and extracts to simplify small library judgement. Authority judge to be generally basede on user character library generate in system 300 data are set and character library generates the valid data of system 300 record, it is intended to ensure user and system data safety. After being judged by authority, then it is made whether to extract the judgement simplifying small library, first can inquire about, according to the encrypted characters string of request data, the historical record that whether have this request data, if it is not, a newly-increased record, and enter extraction and simplify small library module; If it has, what then judge desirable format simplifies whether small library exists, if it does, directly use this to simplify small library, if it does not exist, then enter extraction to simplify small library module.
In technique scheme, it is preferable that small library module is simplified in extraction can according to required font, selected original big TTF character library, and combines required content of text, and big TTF character library is cut to little TTF character library. The mode of concrete cutting has two kinds, one is by the unnecessary font GLYPH data deletion in big TTF character library, only to retain the font GLYPH data of needs, two is from big TTF character library, extract the font GLYPH data that user needs successively, then by the little TTF character library of font GLYPH data genaration extracted. Extract after successfully in little TTF character library, enter compression submodule.
In technique scheme, it is preferable that little TTF character library can be converted to the character library of required various online font formats by compression submodule, such as forms such as TTF, EOT, WOFF, SVG. These forms are all compressed format, it is possible to reduce file amount further, reduce the server transport data volume to the client of webpage, thus improve page access speed.
In technique scheme, it is preferable that return the return data in data module 310 with two kinds of forms, a kind of data that directly CSS code is write webpage for character library generation system 300; The link of the another kind of CSS file for returning to user and font occupation mode, when the webpage that user disposes on request is accessed, character library generates system 300 will automatically generate corresponding CSS code according to the CSS request received, and CSS code is only being accessed in the page effectively. The return data of both forms all do not require that user possesses the relevant knowledge of font-face in CSS3, facilitate User Exploitation work.
In technique scheme, it is preferable that user data memory module 312 storage has all small libraries simplifying small library, various online font format that the JS file of user-specific, user use.
In technique scheme, preferably, in user data memory module 312, the physics that saves as of the file of user-specific JS preserves, its bibliographic structure be Js/Users/ (ID/1024) under system master catalog/(ID %1024)/, filename is to be drawn by special AES by contents such as the user names comprised, thus strengthening the safety of user data, it is simple to the service extension of subsequent file system.
In technique scheme, preferably, in user data memory module 312, user uses the physics that saves as of all small libraries simplifying small library and various online font format to preserve, its bibliographic structure be Font/data/ font ID/ (domain name ID/1024)/(the domain name ID%1024) under system master catalog/, file is called the domain name that comprises, user name, fontname, content of text are drawn by special AES, to strengthen the safety of user data. It addition, the name simplifying small library for identical content, different-format is identical, consequently facilitating generate in character library, system 300 carries out character library lookup, improve character library and generate the work efficiency of system 300, it is simple to the service extension of subsequent file system.
In technique scheme, it is preferable that also have cleaning module in user data memory module 312, cleaning module all simplified small library and various online font format small library thereof mainly for what user used and is designed. This module timing every day carries out cleaning work, in the current data table simplifying small library, only preserves the information being accessed for simplifying small library in nearest 7 days; All it is transferred to history lists, it is simple to add up by not being accessed for information in nearest 7 days later; And the data simplifying small library not being accessed for physical store in nearest 7 days will be deleted; If the data being deleted are accessed again, system required simplifies small library by again extracting, and does not affect the normal use arranging data of user. By this technical scheme, it is possible to only preserve necessary data message, it is to avoid space waste.
Below in conjunction with specific embodiment, the character library shown in Fig. 3 is generated system 300 to be described further.
ID is that the user foundertest of 4 generates in system 300 in character library by user setup module 302 according to demands of individuals that to arrange online font be that upright quiet flower bud is simplified, the English name of the upright simplified correspondence of quiet flower bud is FZJLJW, domain name is http://xiezi.foundertype.com, arranging after successfully, user data memory module 312 can judge that user foundertest's arranges whether data record exists, if existed, to send and there is prompting, it is not repeated to preserve, if there is no, then preserving the domain-name information of user setup, wherein, domain name ID is 3.
Simultaneously, according to the JS file arranging data genaration user-specific, its bibliographic structure be Js/Users/ (ID/1024) under system master catalog/(ID %1024)/, filename is to be drawn by special AES by contents such as the user names comprised, specifically, the storage organization of JS file and name are as follows: Js/Users/0/4/4f4adcbf8c6f66dcfc8a3282ac2bf10a8f860346a02 e832502628f7d87bf6ecb.js.
Next enter request data acquisition module 304, obtain request data and be divided into two ways: User Defined mode and system obtain mode automatically.
User Defined mode is user's online font of selecting voluntarily to set and corresponding domain name, and actively fill in content of text, such as " university of BeiJing, China ", it is then forwarded to character library and generates system 300, character library generates system 300 and receives content of text duplicate removal after necessary data, and after being encrypted by the content of text after ID, domain name, font English name and duplicate removal, generate encrypted characters string 6ab591e473ce55fd05b0732b5aab6821, and arriving this, request data obtains complete.
System is obtained automatically to mode, the page setup that request data is all generated setting system 300 in and user according to user in character library by system automatically obtains, when webpage is accessed, character library generates system 300 and obtains current domain name, generate in character library according to active user and data are set in system 300, judge active user is to whether current domain name is arranged, if be not provided with, then stop to obtain, if arranged, then obtain all font informations that active user is arranged under one's name at the current field, and the character font data of current page is obtained according to font information, to obtain corresponding content of text, to text content duplicate removal, finally, the same with User Defined mode, by ID, domain name, encrypted characters string is generated after content of text encryption after font English name and duplicate removal.
System is obtained automatically to mode, when the webpage applying online font that domain name is http://xiezi.foundertype.com is accessed, it is first determined active user is foundertest, it is judged that whether this user is real user. When judged result is for being, obtains current domain name, and judge that character library generates whether system 300 has the record of current domain name. Additionally, also to judge that user foundertest's arranges the setting having in data independent of domain name http://xiezi.foundertype.com, when arranging, determine that setting font of user under this domain name is simplified for upright quiet flower bud, corresponding English name is FZJLJW, then, the content of text obtaining the quiet flower bud of Founder in the page simplified is " university of BeiJing, China ", to text content duplicate removal, and the content of text after ID, domain name, font English name and duplicate removal is encrypted, to generate encrypted characters string 6ab591e473ce55fd05b0732b5aab6821. And can also according to the browser type of webpage, it is determined that the online font format of needs, such as TTF, EOT, WOFF, SVG etc. For EOT type, after the character library that the compression of target character library generates required EOT type, the file storage structure of the character library after compression is identical with former target character library with name, and simply file format is different.
System is obtained automatically to mode, it is possible to obtain the related data of the online font of many moneys in same webpage, then generate system 300 to character library one by one for these request datas and send request.
For User Defined mode, as long as getting complete request data, just directly sending request Concurrency to server send whole request data; System is obtained automatically to mode, if getting a plurality of partial data, then circulation is sent request Concurrency and send whole request data.
System is obtained automatically to mode, for reducing data transmission, only transmit necessary data, to avoid flow to waste, accelerate page access speed.
In technique scheme, only get a complete request data, namely for user foundertest that ID is 4, its online font is that upright quiet flower bud is simplified, corresponding English name is FZJLJW, and application domain is called http://xiezi.foundertype.com, and content of text is " university of BeiJing, China ", encrypted characters string is 6ab591e473ce55fd05b0732b5aab6821, and the type simplifying small library of required online font is EOT.
Fig. 4 illustrates that the process character library in the character library generation system of Fig. 3 generates the particular flow sheet of request data.
As shown in Figure 4, the idiographic flow processing character library generation request data includes:
Step 402, data check. By data check submodule, it is that the upright quiet flower bud type EOT simplifying small library simplified, application domain name http://xiezi.foundertype.com, encrypted characters string 6ab591e473ce55fd05b0732b5aab6821, required online font verifies to user foundertest, online font font, if all data all meet verification rule, then it is proved to be successful, otherwise, authentication failed, enters step 412, stops data and processes.
Step 404, authority judges. Authority judges that submodule judges whether user exists in character library generation system 300, if user is absent from, enter step 412, stop data and process, if user exists, judge that character library generates the record whether having current domain name in system 300 again, if it did not, enter step 412, stop data and process, if it has, then continuation to be judged active user is to whether current domain name and current font are arranged. If be not provided with, then entering step 412, stopping data and processing, if arranged, then entering step 406.
Such as, ID is that 4 user foundertest exist, domain name http://xiezi.foundertype.com generates in system 300 in character library record, and it is that upright quiet flower bud is simplified that user is already provided at line font in user setup module 302, the English name of the upright simplified correspondence of quiet flower bud is FZJLJW, success corresponding to application domain name http://xiezi.foundertype.com, therefore judge that this request data is had the right to carry out character library and simplified, enter step 406.
Step 406, record and file judge. Search character library generates in system 300 whether there is record according to encrypted characters string, if it does not exist, then be directly entered step 408; If it is present continue to judge required to simplify whether small library file exists, existing if simplifying small library file, will be directed into returning data module 310, call and already present simplify small library file, otherwise enter step 408.
In the example that the upright quiet flower bud of above-mentioned user setup is simplified, because being first time request, so encrypted characters string 6ab591e473ce55fd05b0732b5aab6821 generates in system 300 in character library is absent from record, illustrate that the small library file of simplifying of correspondence also exists scarcely, character library generates system 300 will add record of this request character string, and be directly entered extraction and simplify small library submodule.
Step 408, extracts and simplifies small library. preserve and judged, by authority, the user setup Record ID that submodule finds, clear and definite original word storehouse storing directory in system 300 is generated in character library, the original big TTF character library that upright quiet flower bud is simplified can be quickly navigated to according to upright quiet flower bud is simplified, then " university of BeiJing, China " is converted to concrete UNICODE (Unicode) coding " 4E2D/56FD/5317/4EAC/5927/5B66 ", original big TTF character library obtains the font GLYPH data message of these words, and extract these GLYPH font datas of needs, or delete other unnecessary font datas, in conjunction with the font allocation list in TTF, it is reorganized into one and new simplifies little TTF character library. owing to filename is drawn by special AES by domain name, user name, fontname, content of text, so simplifying the storage organization of little TTF font file and naming as follows: Font/data/8/0/3/6ab591e473ce55fd05b0732b5aab682114084351 06028.ttf.
Step 410, small library is simplified in compression. For EOT type, after the character library that the compression of target character library generates required EOT type, the file storage structure of the character library after compression is identical with former target character library with name, and simply file format is different. Such as: Font/data/8/0/3/6ab591e473ce55fd05b0732b5aab682114084351 06028.eot. It addition, when compressing unsuccessfully, enter step 412, stop data and process.
Required simplify small library file be all ready for ready after, as long as webpage is accessed, so return data module 310 and will simplify small library file accordingly according to encrypted characters string and the acquisition of required online font character library form, and generate available CSS code, the write of this code is accessed for webpage, to realize the effect of online font, wherein, CSS code is as follows:
<styletype='text/css'>
font-face{
Font-family:'FZJLJW';
Src:url (' * * *);
Src:url (' * * *? #iefix') format (' embedded-opentype'),
url('***')format('TrueType')
}
</style>
Wherein * * * represents the return returning data module 310 and simplifies chained address and the parameter of small library interface, simplifies small library interface and directly feeds back the font file simplifying small library according to parameter.
When webpage is accessed, character library generates the browser type that system 300 can accurately be judged to access this webpage, and the CSS code returning data module 310 return will be returned according to browser type, and when browser type is IE, the CSS code of write should be:
<styletype=" text/css ">
font-face{
Font-family:FZJLJWJ;
Src:url (' http://xiezi.foundertype.com/Webfont/Ashx/forjs/getfont.ashx? act=getfont&cvfid=6ab591e473ce55fd05b0732b5aab6821&forma t=eot');
Src:url (' http://xiezi.foundertype.com/Webfont/Ashx/forjs/getfont.ashx? act=getfont&cvfid=6ab591e473ce55fd05b0732b5aab6821&forma t=eot? #iefix') format (' embedded-opentype')
.FZJLJWJ{FONT-FAMILY:'FZJLJWJ'}
</style>
Wherein, the IE browser of the compatible each version of CSS code of the page is write.
According to browser type, the online font of request TTF form, then return data module 310 and write the CSS code of the page and be:
<styletype=" text/css ">
font-face{
Font-family:FZJLJWJ;
Src:url (' http://xiezi.foundertype.com/Webfont/Ashx/forjs/getfont.ashx? act=getfont&cvfid=6ab591e473ce55fd05b0732b5aab6821&forma t=ttf')
Format (' truetype');
}
.FZJLJWJ{FONT-FAMILY:'FZJLJWJ'}
</style>
Return data module 310 presents code in this manner and can set up door chain, and according to browser need return be suitable for simplify small library type, the wasting of resources can be reduced further, promote webpage and be loaded into speed, and, do not require that user possesses the relevant knowledge of font-face in CSS3, facilitate User Exploitation work.
Fig. 5 illustrates the block diagram of server according to an embodiment of the invention.
As shown in Figure 5, the server 500 of one embodiment of the present of invention, system 502 (character library being equivalent in the embodiment shown in Fig. 2 generates system 200) is generated including character library, character library generates system 502 for according to the setting command received or default font info file, character library is set and generates request data, and generate request data according to character library, it is determined that original character library, and in original character library, extract target character library.
In this technical scheme, user can carry out online font setting according to demands of individuals, setting option includes fontname and webpage domain name, and the font info file of this user-specific is generated according to the fontname arranged and webpage domain name, these font info file preset are generally JS (JavaScirpt, formula script of literal translating) file. It addition, when the fontname of user setup and webpage domain name occur to update, font info file also updates therewith. When user needs to obtain the character library simplified, name and the webpage domain name etc. of can directly setting font character library generates request data, can also generate in character library and system 502 reads default font info file, directly obtain the contents such as the fontname arranged and webpage domain name, and generate request data according to the character library arranged, corresponding original character library being cut out or the operation such as extraction, thus obtaining target data, namely the target data obtained adapts to the character library after the simplifying of user's needs. By this technical scheme, it is possible to the character library needing generation low capacity according to user, removing the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, promoting the experience of user.
In technique scheme, preferably, character library generates system 502 and is used for: according to the setting command received, ID for sending setting command arranges webpage domain name, fontname and text data, and text data is carried out duplicate removal, or according to default font info file, obtain the webpage domain name of webpage, fontname and text data when accessing webpage, and text data is carried out duplicate removal; And according to the text data after webpage domain name, fontname and duplicate removal, generate encrypted characters string the type of the browser according to webpage according to predetermined encryption rule, it is determined that the type of required target character library.
In this technical scheme, when user needs to obtain the character library simplified, directly can be set font name, webpage domain name and text data, it is also possible to generates in system 502 in character library and reads default font info file, directly obtains the fontname, webpage domain name and the text data that arranged. After obtaining fontname, webpage domain name and text data, further text data is carried out deduplication operation, to delete repetition data therein.
In this technical scheme, encrypted characters string can also be generated according to the text data after ID, fontname, webpage domain name and duplicate removal, such as, font needed for user foundertest be called upright quiet flower bud simplified time, the content of text " university of BeiJing, China " after this font duplicate removal in English name FZJLJW according to this font and webpage, it is possible to generate encrypted characters string 6ab591e473ce55fd05b0732b5aab6821.
Additionally, in this technical scheme, the type of required target character library can also be determined according to the type of the browser of webpage, wherein, the type of target character library includes TTF (TrueTypeFont), EOT, WOFF, SVG etc., such as, when the webpage that webpage is IE browser opened, it may be determined that the type of target character library is EOT.
In technique scheme, it is preferable that character library generates request data and includes the type of ID, domain name, fontname, encrypted characters string and required target character library.
In technique scheme, it is preferable that character library generates system 502 and is additionally operable to according to the font info file preset, it is determined that character library generates whether request data meets predetermined verification rule; When determining that character library generation request data meets predetermined verification rule, it is allowed to extraction target character library in original character library.
In this technical scheme, before extracting target character library, it is necessary to the authority extracting target character library is verified, such as, it is judged that whether the ID of user generates in system 502 in character library exists, if this ID is absent from, then stop data to process, do not generate the character library simplified for this user. For another example, it is judged that character library generates whether system 502 stores current domain name, if character library generates in system 502 does not store current domain name, then stop data and process, do not generate the character library simplified for this user. Pass through the technical program so that character library generates system 502 and can be only specific user or can only carry out simplifying of character library according to particular data, it is possible to avoids illegal request, it is simple to put goods on the market, it is also possible to avoid malicious requests, protects the safety of data.
In technique scheme, it is preferable that character library generates system 502 and is additionally operable to determine the GLYPH font of text data in original character library; Extract the GLYPH font of text data or delete the GLYPH font beyond text data, to generate target character library.
In this technical scheme, it is possible to the GLYPH font in original character library is cut out or is extracted, to generate the less target character library more simplified of capacity, thus removing the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, promote the experience of user.
In technique scheme, it is preferable that character library generates system 502 and is additionally operable to according to type, the target character library generated is compressed, to obtain the target character library of required type.
In this technical scheme, target character library can be compressed into the types such as TTF (TrueTypeFont), EOT, WOFF, SVG, for EOT type, after the character library that the compression of target character library is generated required EOT type, the file storage structure of the character library after compression is identical with former target character library with name, and simply file format is different. By target character library is compressed, it is possible to obtain the target character library of multiple format, thus having widened the scope of application of the character library after simplifying.
In technique scheme, preferably, character library generates system 502 and is additionally operable to storage font info file, encrypted characters string and target character library, for when the encrypted characters string again generated is identical with the encrypted characters string of storage, the target character library that the encrypted characters string that calls and store is corresponding, and the content of target character library is write webpage with the form of CSS code.
In this technical scheme, font info file, encrypted characters string and target character library etc. are stored, when again carrying out character library and simplifying, if the encrypted characters string generated is identical with the encrypted characters string of storage, then directly invoke the target character library of the corresponding types of storage, without the generation work again carrying out target character library, optimize the speed that webpage loads, be greatly improved Consumer's Experience.
Technical scheme is described in detail above in association with accompanying drawing, pass through technical scheme, request data can be generated according to the character library of user setup, corresponding original character library is cut out or extraction etc. operates, the character library of the low capacity after being simplified, eliminating the redundancy word taken less than in a large number, thus optimizing webpage loading velocity, improving the experience of user.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations. All within the spirit and principles in the present invention, any amendment of making, equivalent replacement, improvement etc., should be included within protection scope of the present invention.