Skip to content

Printing on to paper

Kartikaya Gupta (kats) edited this page May 18, 2018 · 1 revision

Fonts and what to do with them

Primary goal: let's make fonts serialisable to support cross process printing and webrender.

High level list of work items:

  1. SkFontHost_cairo does FcPattern resolution, which may not be necessary anymore
    • cons - cairo-ft requires an FcPattern to pass in some parameters that it doesn't have generic font options for
    • ... so we either still require the FcPattern anyway to construct the font (which rthen equires no changes to SkFontHost_cairo)
    • ... or we have to modify tree-cairo to support passing those parameters (which requires more custom tree-cairo mods)
  2. need to make DrawTargetRecording support passing in some font interpretation/style parameters, not just the font file/descriptor
  3. Linux - implement serialization of the FcPattern data that is required to properly reconstruct FreeType fonts
  4. Android - if this is necessary, then we need to possibly pass along path information in case we can't export SFNT data from FreeType, or otherwise get this by calling back into thebes, via callback or otherwise?
  5. All platforms - implement serialization of gfxFontStyle and other relevant parameters necessary to interpret native fonts
  6. print to file inside sandbox - print to a memory output stream within the content process, then ship the in-memory file contents to the parent process to save to the destination
    • if we don't do this, then we will have problems with font styling until such time as serialization of gfxFontStyle is handled properly
    • eventually the ability to write temporary files from within the sandbox will be removed, so requires writing in-memory, rather than to temporary file
    • Windows - requires some extra glue to deal with setting up an EMF memory stream, instead of just a file

Implementation Plan:

Lee -

  • leave SkFontHost_cario as-is for now with respect to FcPattern
  • implement support for serializing FcPattern data in DrawTargetRecording/ScaledFontFontconfig, force FcPattern resolution at this stage
  • reconstruct FcPattern within NativeFontResourceFontconfig with whatever parameters necessary to make Cairo/Skia happy, then build cairo-ft font directly from this without going through thebes

Unknown benefactor -

  • serialization of relevant gfxFontStyle data
  • deserialization and per-platform interpretation of aforementioned gfxFontStyle data within respective NativeFontResources, but which may be obsoleted as a necessity by...
  • print to memory output stream on content process, then ship to parent process to save

Clone this wiki locally