259 karma · joined Dec 11, 2009 (16y ago) · 41 submissions
2.
Webfont Handbook: Make the web a more efficient and readable environment(abookapart.com ↗)
2 points · by bramstein · 9y ago · discuss
3.
Web Font Anti-Patterns(bramstein.com ↗)
1 points · by bramstein · 11y ago · discuss
comment 11y ago · link · parent
A lot of this will improve when HTTP/2 becomes more common (you can push resource to the browser and parallel downloads will become more efficient).
comment 11y ago · link · parent
Because you already have the font data in JavaScript you can then also store the fonts in localStorage. This way you can avoid making a request for them on the next page load.
Smashing Magazine wrote a bit more about this technique: http://www.smashingmagazine.com/2014/09/improving-smashing-m...
I'm generally against this idea because you're basically reimplementing the browsers' caching mechanism. The CSS Font Loading API (http://www.w3.org/TR/css-font-loading/) will let you do this in a much nicer way and it already has pretty decent browser support (Chrome, Opera and Firefox beta).
6.
Preload Hints for Web Fonts(bramstein.com ↗)
17 points · by bramstein · 11y ago · 9 comments
7.
Detecting system fonts without Flash(bramstein.com ↗)
4 points · by bramstein · 11y ago · discuss
comment 13y ago · link · parent
* http://code.google.com/p/hyphenator/ * https://github.com/bramstein/hypher/
comment 13y ago · link · parent
comment 13y ago · link · parent
My impression is that the users of those programs are unfamiliar with the algorithms used, so I think it is the latter.
comment 13y ago · link · parent
The performance isn't actually that bad, I can perform line breaking in JavaScript on some very large documents, with the only performance bottleneck being DOM node creation (which native implementations won't suffer from.) If necessary the linebreaking could also be done incrementally, with a first first-fit pass and then the Knuth and Plass algorithm.
I could be mistaken, but I'm fairly certain Internet Explorer implements the Knuth and Plass algorithm when using `text-justify: newspaper`. Unfortunately, I can't check because it isn't open source. The output however is pretty much identical to what my JavaScript version generates, so I'm inclined to believe it is the Knuth and Plass algorithm.
comment 13y ago · link · parent
comment 15y ago · link · parent
You can see a test page here, which only works in Firefox due to the feature detection: http://www.bramstein.com/projects/text-overflow/examples.htm...
comment 15y ago · link · parent
For hyphenation you might also want to check out my Hypher project (https://github.com/bramstein/Hypher) which is a minimal hyphenation engine written in JavaScript. In my benchmarks it is about 4 times faster than Hyphenator.js (and a lot smaller.)
comment 15y ago · link · parent
https://github.com/bramstein/Hypher
It is quite small and fast, and mostly aimed at integration with other libraries, unlike Hyphenator.js (which comes with a partial DOM library.) An example integration can be seen in the Treesaver library (https://github.com/bramstein/treesaver/tree/hyphenation) where it is used to hyphenate magazine columns.
comment 15y ago · link · parent
We'll fix it, thanks for reporting it.
comment 15y ago · link · parent
Thanks for catching and reporting it.
comment 15y ago · link · parent
Performance isn't a good argument in my opinion. The algorithm isn't that expensive. The most expensive part right now is retrieving all the text metrics, but you would get that a lot cheaper in the browsers rendering engine.
I briefly looked at hacking it into Webkit, but then gave up due to a lack of time.
comment 15y ago · link · parent
I'm talking to Filipe Fortes of Treesaver about implementing it as part of his Treesaver technology (demo: http://treesaver.publicintegrity.org/smoke_screen) Perhaps a general implementation will roll out of that.
comment 15y ago · link · parent
Yes, this is an application of dynamic programming. The computation is actually quite fast, most of the time is spent in retrieving the text metrics (put each word in a span, retrieve width and move on to the next word.) If that can somehow be alleviated it would become a feasible solution.
I agree with you that browsers should support this natively (Internet Explorer actually does.) If you are interested, I've written a bit on this subject in this Typophile thread: http://typophile.com/node/71247
comment 15y ago · link · parent
http://www.bramstein.com/projects/typeset/flatland/
Earlier incarnations made it to HN before, but unlike the old version this renders in plain HTML instead of Canvas, so text can be selected, copied, etc.
comment 16y ago · link · parent
On the technical side: are things like hyphenation and justification also on your todo/feature list? I've been thinking about putting my work on justification and hyphenation [1, 2] to good use, as the "rendering engine" of a HTML/JS based eBook reader. I haven't given much thought to page layout and scrolling, but I like the direction you are taking it for mobile and iPad users. I would personally prefer a different layout for reading on my desktop machine though (granted I prefer reading on my Kindle.)
[1] http://www.bramstein.com/projects/typeset/flatland/ [2] http://www.bramstein.com/projects/typeset/
comment 16y ago · link · parent
Although the implementation works great, I couldn't get past the (obvious) syntax issues and never actually used it in production code. It was an interesting experiment though, especially when combined with Sjoerd Visscher's algebraic data type library (http://w3future.com/weblog/stories/2008/06/16/adtinjs.xml).
comment 16y ago · link · parent
I was quite hesitant about making the jQuery plugin public because I was fearing reactions such as this. It was meant as a demo, and a nice way to test the layout managers. For a long time I had a message on the jQuery plugin page stating something along the lines of "please, please, consider using CSS before you use this plugin."
The nice thing about programming against a layout manager API is that you can easily write new algorithms while the (DOM) interface remains the same. It would be trivial to write a layout manager that does layout like Masonry. As another example, I'm currently working on a pack layout which can be used to pack small images into a larger one (e.g. CSS sprites,) and a layout manager that implements the CSS box layout module. I was also considering a text layout based on my TeX line breaking work (http://www.bramstein.com/projects/typeset/.)