Tools used
1. http://fontstore.baidu.com/static/editor/index.html
2. http://ai.baidu.com/docs#/OCR-API/9ef46660
The first step is to analyze the fontAnalysis company: Xiaomi Technology https://www.tianyancha.com/company/23402373Are you prompted to log in after clicking? Refer to https://www.baidu.com, or Baidu search for 'Tianyancha Xiaomi Technology Business' so that you don't need to log in.
Use two or three proxies to visit, get the css link https://static.tianyancha.com/fonts-styles/css/e4/e4d5343a/font.css, e4/e4d5343a is spliced into https://static .tianyancha.com/fonts-styles/fonts/e4/e4d5343a/tyc-num.woff, download it, remember to download the html page too.
I call the e4/e4d5343a the version number. The version numbers obtained by different IPs are different, and the font mapping is also different. There are hundreds of mappings a day. If you don’t know how to get the font link, F12, locate the data item that the element is in the business scope. General class='tyc-num lh24' has font mapping. As shown below
Then open the woff file with Baidu font tool, select a few words and remember its font track (attribute d is, of course, you can directly splice the link to https://static.tianyancha.com/fonts-styles/ fonts/e4/e4d5343a/tyc-num.svg can be seen)
Here you can see that the mapping corresponding to 7 is M544 696 l-297 -725 l-99 0 l282 674 l-379 0 l0 85 l493 0 l0 -34 Z, of course, the decimal point has been removed, just look at the svg file. Smart people know what I'm going to do. Yes, when it is determined that the font trajectory remains unchanged, you can store a copy of the trajectory in the library for mapping. When I got multiple sets of fonts, I compared the business scope information of Xiaomi Company for multiple comparisons, and each set of ttf files used the Baidu font tool to view the corresponding mappings of the four words 'technical development' Discovery is constant. Then I have to think about how to get the trajectory of the real font according to different ttf files. The following is my personal show operation.
The second step, coding ideasThe font files have been downloaded, and another svg file is transferred (if you don’t want to transfer , when you downloaded the ttf file before, you should save an svg file) Use Java or python to read the svg file, traverse the values, get the d value, then load the ttf file, pass in the d value, and draw the real font. Save it locally, call the Baidu ocr interface, identify it, and get the real font name. Then store it in the library, and you will get the font -- "font track such a correspondence.
IThe md5 value of the trajectory is stored here for easy retrieval. If the font is skewed, this method will not work. However, you can put the ttf file into the Baidu font tool, press F12 and select a word to modify the value in it. The problem is that the font is broken if it is too large. So even if there is a font tilt, you can also set a threshold of floating up and down to do font trajectory recognition!
You can take a look, 820 characters are mapped back and forth to generate font files for users, which is not much. At this time, it can exist as a microservice. Pass in the fake font list and font url, if there is a new font track that does not exist in the library, download a font file. Start a scheduler every two hours to see if there are new fonts, and if there are any, follow the previous steps to analyze, identify, and store them in the library. The recognition effect can be seen in another article.
Knowing what the friends are hesitating about, how do java and python use font files to write fonts? See the picture below. py version and java versionBecause even if it is a fake font in svg or woff, it must participate in the mapping. This process is a closed loop, otherwise there will be a situation where one font corresponds to two trajectories. The characters passed in here are fake fonts, so what is drawn in this ttf file is the real font, so that we can get the relationship between the track --> the real font. Draw a picture, my language skills are not good.
Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/X%20Eye%20Check%20web%20font%20research.html
评论列表(196条)
测试