gfx/ots/src/name.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/ots/src/name.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#ifndef OTS_NAME_H_
     1.9 +#define OTS_NAME_H_
    1.10 +
    1.11 +#include <new>
    1.12 +#include <string>
    1.13 +#include <utility>
    1.14 +#include <vector>
    1.15 +
    1.16 +#include "ots.h"
    1.17 +
    1.18 +namespace ots {
    1.19 +
    1.20 +struct NameRecord {
    1.21 +  NameRecord() {
    1.22 +  }
    1.23 +
    1.24 +  NameRecord(uint16_t platformID, uint16_t encodingID,
    1.25 +             uint16_t languageID, uint16_t nameID)
    1.26 +    : platform_id(platformID),
    1.27 +      encoding_id(encodingID),
    1.28 +      language_id(languageID),
    1.29 +      name_id(nameID) {
    1.30 +  }
    1.31 +
    1.32 +  uint16_t platform_id;
    1.33 +  uint16_t encoding_id;
    1.34 +  uint16_t language_id;
    1.35 +  uint16_t name_id;
    1.36 +  std::string text;
    1.37 +
    1.38 +  bool operator<(const NameRecord& rhs) const {
    1.39 +    if (platform_id < rhs.platform_id) return true;
    1.40 +    if (platform_id > rhs.platform_id) return false;
    1.41 +    if (encoding_id < rhs.encoding_id) return true;
    1.42 +    if (encoding_id > rhs.encoding_id) return false;
    1.43 +    if (language_id < rhs.language_id) return true;
    1.44 +    if (language_id > rhs.language_id) return false;
    1.45 +    return name_id < rhs.name_id;
    1.46 +  }
    1.47 +};
    1.48 +
    1.49 +struct OpenTypeNAME {
    1.50 +  std::vector<NameRecord> names;
    1.51 +  std::vector<std::string> lang_tags;
    1.52 +};
    1.53 +
    1.54 +}  // namespace ots
    1.55 +
    1.56 +#endif  // OTS_NAME_H_

mercurial