1 /* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.text; 18 19 import android.graphics.Paint; 20 21 /** 22 * TextPaint is an extension of Paint that leaves room for some extra 23 * data used during text measuring and drawing. 24 */ 25 public class TextPaint extends Paint { 26 public int bgColor; 27 public int baselineShift; 28 public int linkColor; 29 public int[] drawableState; 30 public float density = 1.0f; 31 TextPaint()32 public TextPaint() { 33 super(); 34 } 35 TextPaint(int flags)36 public TextPaint(int flags) { 37 super(flags); 38 } 39 TextPaint(Paint p)40 public TextPaint(Paint p) { 41 super(p); 42 } 43 44 /** 45 * Copy the fields from tp into this TextPaint, including the 46 * fields inherited from Paint. 47 */ set(TextPaint tp)48 public void set(TextPaint tp) { 49 super.set(tp); 50 51 bgColor = tp.bgColor; 52 baselineShift = tp.baselineShift; 53 linkColor = tp.linkColor; 54 drawableState = tp.drawableState; 55 density = tp.density; 56 } 57 } 58