LCOV - code coverage report
Current view: top level - gfx/ots/src - fpgm.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 26 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/typography/otspec/fpgm.htm
       9             : 
      10             : #define TABLE_NAME "fpgm"
      11             : 
      12             : namespace ots {
      13             : 
      14           0 : bool ots_fpgm_parse(Font *font, const uint8_t *data, size_t length) {
      15           0 :   Buffer table(data, length);
      16             : 
      17           0 :   OpenTypeFPGM *fpgm = new OpenTypeFPGM;
      18           0 :   font->fpgm = fpgm;
      19             : 
      20           0 :   if (length >= 128 * 1024u) {
      21           0 :     return OTS_FAILURE_MSG("length (%ld) > 120", length);  // almost all fpgm tables are less than 5k bytes.
      22             :   }
      23             : 
      24           0 :   if (!table.Skip(length)) {
      25           0 :     return OTS_FAILURE_MSG("Bad fpgm length");
      26             :   }
      27             : 
      28           0 :   fpgm->data = data;
      29           0 :   fpgm->length = length;
      30           0 :   return true;
      31             : }
      32             : 
      33           0 : bool ots_fpgm_should_serialise(Font *font) {
      34           0 :   if (!font->glyf) return false;  // this table is not for CFF fonts.
      35           0 :   return font->fpgm != NULL;
      36             : }
      37             : 
      38           0 : bool ots_fpgm_serialise(OTSStream *out, Font *font) {
      39           0 :   const OpenTypeFPGM *fpgm = font->fpgm;
      40             : 
      41           0 :   if (!out->Write(fpgm->data, fpgm->length)) {
      42           0 :     return OTS_FAILURE_MSG("Failed to write fpgm");
      43             :   }
      44             : 
      45           0 :   return true;
      46             : }
      47             : 
      48           0 : void ots_fpgm_reuse(Font *font, Font *other) {
      49           0 :   font->fpgm = other->fpgm;
      50           0 :   font->fpgm_reused = true;
      51           0 : }
      52             : 
      53           0 : void ots_fpgm_free(Font *font) {
      54           0 :   delete font->fpgm;
      55           0 : }
      56             : 
      57             : }  // namespace ots
      58             : 
      59             : #undef TABLE_NAME

Generated by: LCOV version 1.13