summaryrefslogtreecommitdiffstats
path: root/samples/ApiDemos
diff options
context:
space:
mode:
authorClara Bayarri <clarabayarri@google.com>2017-06-07 16:42:27 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-06-07 16:42:27 +0000
commite38828eaac979a8bae51c5cbd898aab8289ec946 (patch)
tree7004b930560788337d1a29800a3bdf35e08d2bfc /samples/ApiDemos
parentc6df549cddb356b16dc9fe66bf661b6f78487d65 (diff)
parentac2a416a5b87b1109db5316d534f8d1574c4258f (diff)
downloadandroid_development-e38828eaac979a8bae51c5cbd898aab8289ec946.tar.gz
android_development-e38828eaac979a8bae51c5cbd898aab8289ec946.tar.bz2
android_development-e38828eaac979a8bae51c5cbd898aab8289ec946.zip
Merge "Replace fonts of unclear origin" into oc-dev
am: ac2a416a5b Change-Id: I5592ae97240969a7cc68f38a1599c50bc03322f2
Diffstat (limited to 'samples/ApiDemos')
-rw-r--r--samples/ApiDemos/assets/fonts/samplefont.ttfbin39104 -> 1792 bytes
-rw-r--r--samples/ApiDemos/assets/fonts/samplefont.ttx187
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/graphics/Typefaces.java22
3 files changed, 200 insertions, 9 deletions
diff --git a/samples/ApiDemos/assets/fonts/samplefont.ttf b/samples/ApiDemos/assets/fonts/samplefont.ttf
index 49f1c620b..e8fc3a997 100644
--- a/samples/ApiDemos/assets/fonts/samplefont.ttf
+++ b/samples/ApiDemos/assets/fonts/samplefont.ttf
Binary files differ
diff --git a/samples/ApiDemos/assets/fonts/samplefont.ttx b/samples/ApiDemos/assets/fonts/samplefont.ttx
new file mode 100644
index 000000000..9678a1b60
--- /dev/null
+++ b/samples/ApiDemos/assets/fonts/samplefont.ttx
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ 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.
+-->
+<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="3.0">
+
+ <GlyphOrder>
+ <GlyphID id="0" name=".notdef"/>
+ <GlyphID id="1" name="A"/>
+ </GlyphOrder>
+
+ <head>
+ <tableVersion value="1.0"/>
+ <fontRevision value="1.0"/>
+ <checkSumAdjustment value="0x640cdb2f"/>
+ <magicNumber value="0x5f0f3cf5"/>
+ <flags value="00000000 00000011"/>
+ <unitsPerEm value="1000"/>
+ <created value="Fri Mar 17 07:26:00 2017"/>
+ <macStyle value="00000000 00000000"/>
+ <lowestRecPPEM value="7"/>
+ <fontDirectionHint value="2"/>
+ <glyphDataFormat value="0"/>
+ </head>
+
+ <hhea>
+ <tableVersion value="1.0"/>
+ <ascent value="1000"/>
+ <descent value="-200"/>
+ <lineGap value="0"/>
+ <caretSlopeRise value="1"/>
+ <caretSlopeRun value="0"/>
+ <caretOffset value="0"/>
+ <reserved0 value="0"/>
+ <reserved1 value="0"/>
+ <reserved2 value="0"/>
+ <reserved3 value="0"/>
+ <metricDataFormat value="0"/>
+ </hhea>
+
+ <maxp>
+ <tableVersion value="0x10000"/>
+ <maxZones value="0"/>
+ <maxTwilightPoints value="0"/>
+ <maxStorage value="0"/>
+ <maxFunctionDefs value="0"/>
+ <maxInstructionDefs value="0"/>
+ <maxStackElements value="0"/>
+ <maxSizeOfInstructions value="0"/>
+ <maxComponentElements value="0"/>
+ </maxp>
+
+ <OS_2>
+ <!-- The fields 'usFirstCharIndex' and 'usLastCharIndex'
+ will be recalculated by the compiler -->
+ <version value="3"/>
+ <xAvgCharWidth value="500"/>
+ <usWeightClass value="400"/>
+ <usWidthClass value="5"/>
+ <fsType value="00000000 00001000"/>
+ <ySubscriptXSize value="650"/>
+ <ySubscriptYSize value="600"/>
+ <ySubscriptXOffset value="0"/>
+ <ySubscriptYOffset value="75"/>
+ <ySuperscriptXSize value="650"/>
+ <ySuperscriptYSize value="600"/>
+ <ySuperscriptXOffset value="0"/>
+ <ySuperscriptYOffset value="350"/>
+ <yStrikeoutSize value="50"/>
+ <yStrikeoutPosition value="300"/>
+ <sFamilyClass value="0"/>
+ <panose>
+ <bFamilyType value="0"/>
+ <bSerifStyle value="0"/>
+ <bWeight value="5"/>
+ <bProportion value="0"/>
+ <bContrast value="0"/>
+ <bStrokeVariation value="0"/>
+ <bArmStyle value="0"/>
+ <bLetterForm value="0"/>
+ <bMidline value="0"/>
+ <bXHeight value="0"/>
+ </panose>
+ <ulUnicodeRange1 value="00000000 00000000 00000000 00000001"/>
+ <ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/>
+ <ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
+ <ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
+ <achVendID value="UKWN"/>
+ <fsSelection value="00000000 01000000"/> <!-- the last bit is for italic -->
+ <usFirstCharIndex value="32"/>
+ <usLastCharIndex value="122"/>
+ <sTypoAscender value="800"/>
+ <sTypoDescender value="-200"/>
+ <sTypoLineGap value="200"/>
+ <usWinAscent value="1000"/>
+ <usWinDescent value="200"/>
+ <ulCodePageRange1 value="00000000 00000000 00000000 00000001"/>
+ <ulCodePageRange2 value="00000000 00000000 00000000 00000000"/>
+ <sxHeight value="500"/>
+ <sCapHeight value="700"/>
+ <usDefaultChar value="0"/>
+ <usBreakChar value="32"/>
+ <usMaxContext value="0"/>
+ </OS_2>
+
+ <hmtx>
+ <mtx name=".notdef" width="500" lsb="93"/>
+ <mtx name="A" width="1000" lsb="93"/>
+ </hmtx>
+
+ <cmap>
+ <tableVersion version="0"/>
+ <cmap_format_4 platformID="3" platEncID="10" language="0">
+ <map code="0x0041" name="A" />
+ </cmap_format_4>
+ </cmap>
+
+ <loca>
+ <!-- The 'loca' table will be calculated by the compiler -->
+ </loca>
+
+ <glyf>
+ <TTGlyph name=".notdef" xMin="0" yMin="0" xMax="0" yMax="0" />
+ <TTGlyph name="A" xMin="0" yMin="0" xMax="1000" yMax="1000">
+ <contour>
+ <pt x="0" y="0" on="1"/>
+ <pt x="1000" y="0" on="1"/>
+ <pt x="500" y="1000" on="1"/>
+ </contour>
+ <instructions><assembly></assembly></instructions>
+ </TTGlyph>
+ </glyf>
+
+ <name>
+ <namerecord nameID="0" platformID="3" platEncID="1" langID="0x409">
+ Copyright (C) 2017 The Android Open Source Project
+ </namerecord>
+ <namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
+ Sample Font
+ </namerecord>
+ <namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
+ Regular
+ </namerecord>
+ <namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
+ Sample Font
+ </namerecord>
+ <namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
+ SampleFont-Regular
+ </namerecord>
+ <namerecord nameID="13" platformID="3" platEncID="1" langID="0x409">
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ 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.
+ </namerecord>
+ <namerecord nameID="14" platformID="3" platEncID="1" langID="0x409">
+ http://www.apache.org/licenses/LICENSE-2.0
+ </namerecord>
+ </name>
+
+ <post>
+ <formatType value="3.0"/>
+ <italicAngle value="0.0"/>
+ <underlinePosition value="-75"/>
+ <underlineThickness value="50"/>
+ <isFixedPitch value="0"/>
+ <minMemType42 value="0"/>
+ <maxMemType42 value="0"/>
+ <minMemType1 value="0"/>
+ <maxMemType1 value="0"/>
+ </post>
+
+</ttFont> \ No newline at end of file
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Typefaces.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Typefaces.java
index 08facaa41..dadc3015e 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Typefaces.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Typefaces.java
@@ -17,7 +17,10 @@
package com.example.android.apis.graphics;
import android.content.Context;
-import android.graphics.*;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
@@ -30,25 +33,26 @@ public class Typefaces extends GraphicsActivity {
}
private static class SampleView extends View {
- private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Typeface mFace;
public SampleView(Context context) {
super(context);
- mFace = Typeface.createFromAsset(getContext().getAssets(),
- "fonts/samplefont.ttf");
-
+ mFace = Typeface.createFromAsset(getContext().getAssets(), "fonts/samplefont.ttf");
mPaint.setTextSize(64);
}
- @Override protected void onDraw(Canvas canvas) {
+ @Override
+ protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.WHITE);
-
mPaint.setTypeface(null);
- canvas.drawText("Default", 10, 100, mPaint);
+ canvas.drawText("Draw with Default:", 10, 100, mPaint);
+ canvas.drawText(" SAMPLE TEXT", 10, 200, mPaint);
+ canvas.drawText("Draw with Custom Font", 10, 400, mPaint);
+ canvas.drawText("(Custom Font draws 'A' with solid triangle.)", 10, 500, mPaint);
mPaint.setTypeface(mFace);
- canvas.drawText("Custom", 10, 200, mPaint);
+ canvas.drawText(" SAMPLE TEXT", 10, 600, mPaint);
}
}
}