syntax = "proto2";

/**
 * Open Source'd font metadata proto formats.
 */
package google.fonts_public;

option java_package = "com.google.fonts.proto";
option java_outer_classname = "FontsPublic";

message FamilyProto {
  required string name = 1;
  required string designer = 2;
  required string license = 3;

  // A mutually-exclusive category for each font. The categories are: Serif,
  // Sans Serif, Display, Handwriting and Monospace. Being mutually exclusive is
  // a significant deficiency as, for example, most Display fonts are typically
  // Serif or Sans Serif and that is not captured.
  //
  // For searching, this field is replaced by stroke and classifications (see
  // below), however, this field persists (it's required after all) and will
  // continue to be populated in the onboarding process.
  //
  // This is repeated field, yet Google Fonts only uses the last entry so
  // multiple entries should be avoided.
  repeated string category = 4;  // Only the LAST value is used by Google Fonts
  required string date_added = 5;
  repeated FontProto fonts = 6;
  repeated string aliases = 7;
  repeated string subsets = 8;
  optional string ttf_autohint_args = 9;
  repeated AxisSegmentProto axes = 10;
  map<string, float> registry_default_overrides = 11;
  optional SourceProto source = 12;
  optional bool is_noto = 13;
  repeated string languages = 14;
  repeated FamilyFallbackProto fallbacks = 15;
  map<string, string> sample_glyphs = 16;
  optional SampleTextProto sample_text = 17;
  optional string display_name = 18;
  repeated GlyphGroupProto ordered_sample_glyphs = 19;
  // Optional url for more info about the font.
  optional string minisite_url = 20;
  // The script to use when picking sample text. See the Script spanner table.
  optional string primary_script = 21;

  // Stroke of the letter forms: serif, sans serif, or slab serif.  A family
  // has a single stroke and may have none at all. The values are strings that
  // in all uppercase with spaces replaced by underscores:
  //    SERIF
  //    SANS_SERIF
  //    SLAB_SERIF
  optional string stroke = 22;

  // A family's broad classifications: display, handwriting, monospace, and
  // symbols (not text). The values are in all uppercase:
  //    DISPLAY
  //    HANDWRITING
  //    MONOTYPE
  //    SYMBOLS
  repeated string classifications = 23;

  // Next = 24
}

message FontProto {
  required string name = 1;
  required string style = 2;
  required int32 weight = 3;
  required string filename = 4;
  required string post_script_name = 5;
  required string full_name = 6;
  optional string copyright = 7;
}

message AxisSegmentProto {
  optional string tag = 1;
  optional float min_value = 2;
  reserved 3;
  reserved "default_value";
  optional float max_value = 4;
  // Next = 5
}

message SourceProto {
  optional string repository_url = 1;
  optional string branch = 5;
  optional string commit = 2;
  optional string archive_url = 3;
  repeated SourceFileProto files = 4;
  // Next = 6
}

// A file to take from source and where to put it in dest
// Ex web/split/Roboto[wdth,wght].ttf => Roboto[wdth,wght].ttf
message SourceFileProto {
  optional string source_file = 1;
  optional string dest_file = 2;
}

enum TargetTypeProto {
  TARGET_UNSPECIFIED = 0;
  TARGET_OS_WINDOWS = 1;
  TARGET_OS_MAC = 2;
  TARGET_OS_LINUX = 3;
  TARGET_OS_ANDROID = 4;
  TARGET_OS_IOS = 5;
}

// Message so we can add additional fields like value in future
message TargetProto {
  optional TargetTypeProto target_type = 1;  //  e.g., OS
}

message FamilyFallbackProto {
  repeated AxisSegmentProto axis_target = 1;  // activate for this region
  repeated TargetProto target = 2;            // activate for any of these
  optional float size_adjust_pct = 3;         // e.g. 90%
  optional float ascent_override_pct = 5;     // e.g. 110%
  repeated string local_src = 4;  // e.g. Impact; the local family to use
  // Next = 6
}

// Corresponds to SampleTextProto in
// google3/java/com/google/fonts/backend/spanner/google_fonts_proto.proto
message SampleTextProto {
  optional string masthead_full = 1;
  optional string masthead_partial = 2;
  optional string styles = 3;
  optional string tester = 4;
  optional string poster_sm = 5;
  optional string poster_md = 6;
  optional string poster_lg = 7;
  optional string specimen_48 = 8;
  optional string specimen_36 = 9;
  optional string specimen_32 = 10;
  optional string specimen_21 = 11;
  optional string specimen_16 = 12;
}

message GlyphGroupProto {
  optional string name = 1;
  optional string glyphs = 2;
}
