Why don't cross-platform applications like Chrome use FreeType to render text? - browser

Just looking through the list of issues for the chromium project, a large number of them are cross-platform text rendering issues. Having to use the platform's text rendering system, and cater to their respective idiosyncrasies, I imagine is a lot of work.
Why not simply use the FreeType library and be done with it? FreeType is used in Linux, iOS and Android, among other platforms. So on these platforms, browsers are using a wrapped FreeType library anyway. Why not scrap that wrapping, scrap the platform-supplied rendering on Windows and Mac, and go pure FreeType?
The only answer that occurs to me is that perhaps it's to take advantage of the hardware accelerated composition and blending of glyphs that Windows- and Mac-supplied rendering offers.
Or my other answer is that perhaps it was because WebKit was ported before the subpixel antialiasing patents had expired, so the only way to get subpixel antialiased text was to use platform-supplied rendering.
Are either of these correct? If not, what is the case?

When Safari was ported to Windows, it came with a port of Apple text renderer. Popular opinion was that the text was blurry and illegible.
People get really, really used to how their system renders text and react very sensitively, and very annoyed indeed, to anything different.

Related

What is responsible for font rendering on linux?

I am sorry if my question is a bit vague. I am trying to understand where to look for my problems. I have a regression test suite that captures and compare the screen. It seems like whenever we do some kind of library upgrade the regression tests would fail. Our font settings are the same. The difference would be like the graphics card upgrade (driver), window manager upgrade, or just third party library upgrade (for example Qt library). From human visual testing, the fonts look almost identical, but if I do pixel to pixel comparison, it would show that the snapshots are different. Does anyone have insight how the fonts are rendered ?
Graphics rendering on Linux is a proper mess. While Linux is about as old as Windows, Linux first tried to copy the old X11 window system. This was one of the oldest GUI systems in the world, and it shows - the API is beyond horrible. As a result, lots and lots of libraries were stacked on top of X11 to make it workable, with various degrees of compatibility.
To make things worse, X11 was not just a single implementation, there were competing X11 implementations. Linux chiefly used XFree86, which later became Xorg. And because that's not confusing enough, recent developments added a number of alternatives to X11, which support backwards-compatibility interfaces to X11. Some of those GUI libraries on top of X11 are aware of these new libraries, and may now use the new interfaces.
So, you basically have a pretty fragile system, and any library with a decent programming model has shaky foundations. It's no wonder that changing any part may suddenly cause re-rendering, possibly even choosing entirely new rendering paths.
Windows is a bit better, but it too is old and has some competing GUI libraries. The reason why it's better is probably threefold: there's a single party in control of all the interfaces (Microsoft), they were aware of the bad X11 design from the start (avoided beginner mistakes) and Microsoft has far more resources to spend.
But still, both Linux and Windows had to evolve to support Unicode and the much larger fonts it brought, 24 bits color, high-DPI screens, LCD screens with subpixel resolution, accelerated GPU's, etc. And it's been hard for both to dump old interfaces.

Graphics get aliased when go fullscreen in HaxeFlixel?

The graphics in Flash and non-fullscreen is anti-aliased and really smooth. But when go fullscreen or on mobile, the graphics become aliased. Even when I use SVG image.
Yes Flash has some great aliasing with software cpu based rendering. In the mobile targets of HaxeFlixel there is a method for drawing that is very different, mostly for performance reasons.
In HaxeFlixel the mobile and cpp targets will use the gpu which is more like webgl or Flash's Stage3d. This means that there will be differences in the way things like edges of images and text look.
Flixel and OpenFL do a very good job in making these two methods as similar as possible. Some recent work on text for cpp in OpenFL has been very impressive. I am not aware of any solution that makes the two pixel perfect in a complex game engine for every use case. You will find similar differences with aliasing in flash game engines like Starling which also use the gpu.
Some things you can try:
For OpenFL/HaxeFlixel I have set gpu antialiasing before, this should be the default:
<window antialiasing="4" />
If you are wanting to test, you will loose performance however I believe you can still set software rendering in cpp with.
FlxG.camera.antialiasing = true;
You mention SVG, I think you are assuming since its a vector format it should render perfectly. The gpu rendering first rasterises the image to a bitmap so if you are expecting it to scale etc like it does in the browser it wont. You could in this case use a higher resolution image and scale it down first.

What text rendering library Chrome uses for Linux?

Are they using freetype or xfonts or cairo or something else? Maybe their own made library? I am thinking to use the same library in my program as well. I think what Google uses will be well maintained for long time.
The accepted answer is not correct. Under the hood, Skia uses Uniscribe on Windows, HarfBuzz on Linux + ChromeOS, and CoreText on the Mac. (Actually it's possible at this point, much of the Uniscribe and CoreText code has also been replaced with HarfBuzz for consistency.) Skia is used only to draw glyphs after the the shaping/layout code has done its job.
https://skia.org/docs/user/tips/ : "Skia does not shape text. Skia provides interfaces to draw glyphs, but does not implement a text shaper. Skia’s client’s often use HarfBuzz to generate the glyphs and their positions, including kerning."
Chrome uses Skia for nearly all graphics operations, including text
rendering. GDI is for the most part only used for native theme
rendering; new code should use Skia.
http://www.chromium.org/developers/design-documents/graphics-and-skia
Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.
Skia Project Page:
http://code.google.com/p/skia/

incorrect rendition of a font on browser

Can anyone please help me understand what resources the system uses to render fonts on the browser? For e.g. graphics card, memory, etc. Sorry for this vague question but I am facing a problem here. We have a custom font which gets rendered differently in same versions of safari browsers in different systems. For instances, in some systems the fonts appears to be a bit bolder and due to that it is taking up more space to get displayed. All the systems have same resolution.
Safari uses Quartz to render fonts on OS X. I'm not sure what it uses on Windows but it seem it doesn't use Windows rendering engine for that. Quartz utilizes some of the graphic card resources but it's still mostly software rendering.
Quartz has a number of rasterization options that can influence font appearance. One of the most prominent is Font Smoozing. Here's an article about Font Smoothing on support forums. Though, I don't think it should change the amount of space rasterized text actually takes.
You may have problems with fonts themselves. Maybe, different systems have different versions of the font you use and that changes the way it looks. Or your font doesn't get loaded on some systems and Safari uses a fall back font. There may be many reasons. It's hard to tell what exactly causes your problems just from your description.

how Font and text rendering is done in different OSes

How font rendering is done in linux, bsd, windows? how they differ?
I am not talking about browser web font rendering.say for example how input system works? I press mouse keys. they trigger evdev drivers of linux kernel, and the kernel manages the higher level ops.
low level font rendering mechanism. how freetype, pango, window manager, interact with each other. another big question? how unicode support is accomplished??
simply, when I type a character in a text editor, what are the paths does the character flow before coming into the screen. how the MS word or LibreOffice render different fonts together in single canvas??
On *nix text-rendering is done client-side nowadays which means apps use whatever lib they like best to transform unicode codepoints to pixels and feed the result to x. The actual libs used wary widely though people has been converging on fontconfig + freetype + freebidi + harfbuzz in the past years, usually accessed through pango-cairo
A summary was posted here a few years ago
http://behdad.org/text/
It's all a devilishly complex process, you have weeks of reading if you want to understand all the steps involved.
text-rendering linux fonts

Resources