Extension:UniversalLanguageSelector/Fonts for Chinese wikis/Development Report
Midterm Report: Demo of FontTailor
- Setup environment
You should run a mediawiki site, a real one on a server, or an experimental one like MediaWiki-Vagrant. Note that current demo uses fontforge in font tailoring, so you must have it on the server. In vagrant just run:
sudo apt-get install fontforge
- Install the featured ULS extension
In /mediawiki/extensions, clone a copy of the modified UniversalLanguageSelector by running
git clone https://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector.git && git review -d 139662
Remember to add the line below to /mediawiki/LocalSettings.php if you haven't:
Now, the mediawiki should have had the FontTailor feature.
- Create a page to trigger the feature
You can create a wiki page, and write 2 lines:
<p style="font-family:WenQuanYi Micro Hei, 宋体">我有一头小毛驴，我从来也不骑。有一天我心血来潮，骑它去赶集。我手里拿着小皮鞭，我心里真得意。不知怎么哗啦啦啦啦啦，摔了一身泥。［文泉驿微米黑，宋体］</p>
If the FontTailor works well, you can expect the second line shows Chinese in WenQuanYi Micro Hei font. Otherwise both of the lines will display the same ( in 宋体 ).
- Check the result
You should see the difference if everything goes well. In some browser's debug tool you can find that the webfont request has been replaced with a FontTailor.php request, which returns a tailored font file around 27KB. It contains only the chars in the page, so the size may differ if you try different sentences. The original WenQuanYiMicroHei font has 4.7MB. Open the screen shot to make it clear.
Community Bonding Period Report
Pretty good for me. we discuss in wikizh-l. There are the users of my product. They have even given me some technical advice.
- Clarify to do next
Finished some design Font Tailor Design
Will Start coding soon.
- About schedule
Both of my mentors will be a little busy during the event, just as I was notified when applying. So I will stay closer with wikizh-l. I have confidence to get the job done.
And just as I clarified in the proposal, I have to spend some time on my master's thesis and other graduation related affairs in May and June. Full speed will start since July. So maybe you'll see some delay before midterm. I'll explain such issues in weekly-report.
Main doc has been completed. All code finished has been pushed to gerrit.
Went into some trouble with my instance on wikilabs. I just cannot login to it. I'm asking for help on irc and through email.
Finished the new Tofu-Detect and Missing-Glyph popup. Main features are all done, now. Get a WikiLab instance to run a demo.
I didn't work on the glyph collector. It's strange to plugin such things in a wiki page. Maybe it's better to redirect to another place for glyph-contribute tasks. e.g. the contribute page of the font's site, or a cooperative project on WikiData. That's another really big topic.
Today is the soft pencil down date. This week I'll write some docs, give a final-term report, and setup the WikiLab instance.
Have a hard time designing the glyph collector, especially detecting the missing glyph and add collector UI over the tofu. I think I have found a way out, currently. Not perfect but working. Things will be done before the soft pencil down date.
New version of FontTailor, more efficient and elegant.
Working on detecting Hanzi tofu and designing glyph collector currently. Demo will be ready in one week.
Main features are finished, now. Finally I choose the ArticleViewHeader hook to trigger font tailor. It works fine.
- Got some review comments from Nikerabbit. Some fixup and cleaning work will be done this week. Then the FontTailor feature will reach a ready-to-show status.
- I know there will be a long time make it ready-to-merge. So a new standalone project is created here, to make the work more reachable.
- And a demo site will be hosted somewhere to let ordinary users can have a try.
- Next I'll work on the glyph collector for tofu.
Find a most proper way to trigger font-tailor finally. Hook ArticlePageDataAfter event:
- Whether it contains special font-face, such as Chinese Hanzi font
- Whether a tailored font has been there for this article
Take a lot of time to explore different solutions, including reading database during a webfonts request. It's difficult to setup context before calling the components in core. I did it but finally discarded because it's so ugly. I think the current idea is good enough.
Very promising that you'll see a almost finished FontTailor next week.
Some thoughts on optimization of FontTailor:
- Use WikiPage to load page data from database directly, while not curl the url via http. Not done because I cannot get a proper context to call the functions, yet.
- Use charset to locate the tailored font. Just like Git, store data by tracking the content, while not filename. Previously, I locate a font file according to parameters like: title=page_a, time=123456. It will go to FONTNAME_page_a_123456.ttf. In this way, every page and every revision will generate a font file. Now I want to change it to tracking content. Any request with chars "1379aceglo" will go to FONTNAME_`sha1("1379aceglo")`.ttf. Then some page and some revision will share the same tailored font.
- Cannot call functions in /mediawiki/includes because lack of context during webfont request.
- Start working at full speed!
Find a way to read and parse wiki page characters directly, while not using php_curl.
Last week in college, many things to do, including graduation parties :). Will start working full time since next Monday.
See Midterm Report
Looking for a solution of font tailor. Finally decide to use php-font-lib. I tested it with a demo. Look good.
Finish the compiler, which direct a static font request to a dynamic api: FontTailor.php
- To do
Finish a working demo before the mid-term.
Test the feasibility of dynamic-webfonts.
- To do
Start working on font tailor.
Nothing, actually. Just as explained last week, I'll defend my master's thesis on May 28, and I'm preparing for it.
- To do
Try implementing Dynamic Webfont.
Another coming event is graduation-travel to northwest China (May 31 ~ June 6). So the next weekly-report will be on June 8.
After that I will follow a stabler schedule.
- Design font tailor
- To do
- START coding!
- I'll defend my master's thesis on May 28. It will take some time to prepare.
- To do
- Finish designing the font-tailor. Be ready to start coding on May 19
- Knowledge preparation: Git, JS, jQuery. I use Hg and script languages like Python a lot, so it's easy to get started.
- Study the tech talk about Unit testing.
- To do
- Read ULS docs and code
- Build up development environment