LCOV - code coverage report
Current view: directory - gfx/ots/src - fpgm.cc (source / functions) Found Hit Coverage
Test: app.info Lines: 22 0 0.0 %
Date: 2012-06-02 Functions: 4 0 0.0 %

       1                 : // Copyright (c) 2009 The Chromium Authors. All rights reserved.
       2                 : // Use of this source code is governed by a BSD-style license that can be
       3                 : // found in the LICENSE file.
       4                 : 
       5                 : #include "fpgm.h"
       6                 : 
       7                 : // fpgm - Font Program
       8                 : // http://www.microsoft.com/opentype/otspec/fpgm.htm
       9                 : 
      10                 : namespace ots {
      11                 : 
      12               0 : bool ots_fpgm_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
      13               0 :   Buffer table(data, length);
      14                 : 
      15               0 :   OpenTypeFPGM *fpgm = new OpenTypeFPGM;
      16               0 :   file->fpgm = fpgm;
      17                 : 
      18               0 :   if (length >= 128 * 1024u) {
      19               0 :     return OTS_FAILURE();  // almost all fpgm tables are less than 5k bytes.
      20                 :   }
      21                 : 
      22               0 :   if (!table.Skip(length)) {
      23               0 :     return OTS_FAILURE();
      24                 :   }
      25                 : 
      26               0 :   fpgm->data = data;
      27               0 :   fpgm->length = length;
      28               0 :   return true;
      29                 : }
      30                 : 
      31               0 : bool ots_fpgm_should_serialise(OpenTypeFile *file) {
      32               0 :   if (!file->glyf) return false;  // this table is not for CFF fonts.
      33               0 :   return g_transcode_hints && file->fpgm;
      34                 : }
      35                 : 
      36               0 : bool ots_fpgm_serialise(OTSStream *out, OpenTypeFile *file) {
      37               0 :   const OpenTypeFPGM *fpgm = file->fpgm;
      38                 : 
      39               0 :   if (!out->Write(fpgm->data, fpgm->length)) {
      40               0 :     return OTS_FAILURE();
      41                 :   }
      42                 : 
      43               0 :   return true;
      44                 : }
      45                 : 
      46               0 : void ots_fpgm_free(OpenTypeFile *file) {
      47               0 :   delete file->fpgm;
      48               0 : }
      49                 : 
      50                 : }  // namespace ots

Generated by: LCOV version 1.7