// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package designcompose.definition.view;

import "definition/element/background.proto";
import "definition/element/font.proto";
import "definition/element/path.proto";
import "definition/element/variable.proto";

option java_package = "com.android.designcompose.definition.view";
option optimize_for = LITE_RUNTIME;
option java_multiple_files = true;

// These are the style properties that apply to text, so we can use them on
// subsections of a longer string. We then assume that every style transition is
// a potential line break (and also run the linebreaking algorithm on the
// content of every style for the normal case where we need to break text that's
// all in one style).
message TextStyle {
  element.Background text_color = 1;
  element.NumOrVar font_size = 2;
  optional string font_family = 3;
  element.FontWeight font_weight = 4;
  element.FontStyle font_style = 5;
  element.FontStretch font_stretch = 6;
  float letter_spacing = 7;
  element.TextDecoration text_decoration = 8;
  element.LineHeight line_height = 9;
  repeated element.FontFeature font_features = 10;
  element.Hyperlink hyperlink = 11;
}

// A section of text with a specific style
message StyledTextRun {
  string text = 1;
  TextStyle style = 2;
}
