drawing text x axis, can achieve the effect of the text stretching
*
* Settextsize (float textSize);
* Set font size for drawing text
*
* SETTEXTSKEWX (float skewx);
* Set italic text, skewx to oblique radians
*
* Settypeface (Typeface Typeface);
* Set typeface object, that is, font style, including bold, italic and liner body, non-lin
, "Yesterday," "3 hours ago," etc.
XregexpRegular Expressions can be already used in JavaScript with the Regexp object.XregexpAdds more power to Regexp with features that will be part ofBrowsers Of Tomorrow (according to proposals for ecmascript 4-ES4 ).Using the library, Regexp objects can be cached and reused, ModifiersCan be added to existing Regexp objects and more.
Javascript URL LibraryA library for handling and manipulating URLs more easily. It is possibleTo reach every part of a UR
beginning and ending* Stroked lines and paths. The default is butt.*/Public Enum cap
Internal static class: we can see from the code that painting has a lot to do with this fontinfo.
Public static final class fontinfo {Font mfont;Java. AWT. fontmetrics mmetrics;}
There are three constructor types:
Public paint (){This (0 );}
Public paint (INT flags ){Setflags (flags | default_paint_flags );Initfont ();}
Public paint (paint ){Set (paint );Initfont ();}
T
(boolean fakeBoldText)// Set the pseudo-bold textVoidSetLinearText (boolean linearText)// Set linear textPathEffectSetPathEffect (PathEffect effect)// Set the path effectRasterizerSetRasterizer (Rasterizer rasterizer) // sets the grating.ShaderSetShader (Shader shader)// Set the shadow.VoidSetTextAlign (Paint. Align align)// Set text alignmentVoidSetTextScaleX (float scaleX)// Set the text zoom factor, and 1.0f is the originalVoidSetTextSize (float textSize)// Set the font sizeTypefaceSetTypefa
1. Get the color in the configuration file and set the control to this color.Java code
// Obtain the color in the color. xml file.
Int TMP = getresources (). getcolor (R. drawable. Blue); // obtain the color in the configuration file.
Mybutton. settextcolor (TMP );
2. Set the text font in the control.Java code
Mytext. settypeface (typeface. createfromasset (getassets (), "fonts/handmadetypewriter. TTF"); // set the font
Fontbutton. settypeface
First, create an xml file. The resource type is drawble and the root element is shape.
I. Custom draw lines
You can use the textview control in the layout xml file to set the background attributes.
Ii. Custom circle
Use the imageview control in the layout xml file
3. Customize the rectangle
4. Use custom Fonts
Copy the font format file. ttf to the assets Directory, read the font file Typeface. createFromAsset, and set the type setTypeface.
T
// Obtain the public static bitmap scalebitmap (string SRC, int max) of the reduced image {// obtain the height and width of the image bitmapfactory. options = new bitmapfactory. options (); // This setting enables bitmapfactory. the image obtained by decodefile is empty, but the image information is written to options. injustdecodebounds = true; bitmapfactory. decodefile (SRC, options); // to improve the accuracy of the calculation ratio, the original 640 is reduced to 64 max = max/10; int be =
void Setargb (int a, int r, int g, int b) Sets the Paint object color, parameter one is Alpha transparent channelvoid Setalpha (int a) sets Alpha opacity with a range of 0~255void Setantialias (Boolean AA)//whether anti-aliasingvoid setcolor (int color) //Set color, here the Android internal definition has a color class containing some common color definitions . void Setfakeboldtext (Boolean Fakeboldtext) //Set pseudo-bold text void Setlineartext (boolean Lineartext) //Set linear text p
First of all, if the Android internal fonts are not the fonts we need, then we need to import the font files into the Android development project, we will explain in detail in the afternoon:1. We first analyze that I want the font of the text in the TextView control is: Chinese in italics , we found that this is not available within the Android system, so we have to import the italic file ourselves. TTFWe put the font file of Chinese italics into the assets folder, create a new Fonts folder to
[0] = -1;int suffix = 0; suffix int prefix =-1; prefix while (suffix The code is not complex, the whole idea is to t[0]~t[suffix] as a substring, in turn, to find the equivalent of these substrings of the maximum prefix suffix sub-sequence, that is, the value of Next[suffix].It is difficult to understand that there are two places, I marked out with 1 and 2 respectively. We'll see in turn. As shown in the initialization process, prefix points to -1,suffix 0,next[0] =-1.The If condition prefix =
Android custom View combination control ---- LED digital clock
First
LEDView effect.
Previously, I saw a blog using two textviews to achieve this effect. So I want to use a custom control to implement an LEDView, which can be used directly.
The combination of controls, the two textviews stacked together, and then use the digital-7.ttf font to display data, so as to achieve the LED effect. The Code is as follows:
LEDView. class
Package ione. zy. demo; import java. io. file; import java. util. c
fill_or_strokeSetxfermode (Xfermode xfermode);Sets the way in which graphics overlap, such as merging, intersection, or union, often used to create eraser effects2. Text renderingSetfakeboldtext (Boolean fakeboldtext);Simulation to implement bold text, set in small font effect will be very poorSetsubpixeltext (Boolean subpixeltext);Setting this to True will help the text appear on the LCD screenSetTextAlign (Paint.align Align);Set the alignment direction of the drawing textSettextscalex (float
during painting, such as smooth effects.
SetStrokeWidth (float width );
When the paint brush style is STROKE or FILL_OR_STROKE, set the width of the paint brush.
SetXfermode (Xfermode xfermode );
Sets the processing method when the image overlaps, such as merging, intersection or union, which is often used to make the eraser erasure effect.2. Text Rendering
SetFakeBoldText (boolean fakeBoldText );
Simulate the implementation of bold text, the effect on small font will be very poor
SetSubpixelTe
/17148535
11. Fonts Font Library:
Arimo Font:
Http://www.fontsquirrel.com/fonts/arimo/fonts/arimo
Https://www.google.com/fonts#UsePlace:use/Collection:Arimo
The Chinese font library is generally otf, directly changed to ttf can be used, Demo is as follows: Self: http://www.eoeandroid.com/thread-163834-1-1.html
Public class Y_fonts extends Activity {/** Called when the activity is first created. * // @ Override public void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState)
This example mainly uses the font, but android comes with only a few types. Although android provides the font reprinting function, I tried it and did not find it successful, so I didn't get it in the code, so I got it. Try again tomorrow and find that the book code is not very suitable for android. When the font size increases, there will be a bug that only two lines can be entered. I will revise this bug later
Below is:
MainView code:
Java code
Package com. wjh. demon_5;
Import android. co
When doing Android development, some software will require some special fonts, we need to introduce the external TTF format font into the program, the specific steps are:Create a new fonts directory in the Android app directory assets, copy the TTF font file we need to use (the OTF format directly changes the suffix to TTF), then the code:// Save the font file in the assets/fonts/directory, in program Typeface
comparison can explain the problem.You can see the serif on the default font, adding a liner. The nonospace limits the width of each character, allowing them to achieve an equal-width effect.The equal width in fact very good understanding, what is the liner exactly mean? Here is a picture of Wikipedia that gives you a visual explanation of the problem.Liner is actually the font edge of that little tweet.3.3 android:fontfamilyfontFamilyIt looks like it's right
new technology, but it has existed and been in use for many years. sIFR is a useful and handy text replacement technology that embeds network fonts into the page by FLASH+JS+CSS.
Considering the internet has a lot of resources, this article will not repeat, want to know friends can refer to the article:
How and when to use SIFR
sifr-Text Replacement Technology
sifr--Baidu Encyclopedia
Typeface.js
Typeface is considered to be the best alternativ
Font is the appearance of text display and printing, it includes the characters of words, style and size, and many other attributes. Appropriate choice of different fonts, can greatly enrich the external expression of the text. For example, some important words in the text with a thicker font display, can reflect the prominent, emphasis of the intention. Of course, text output can also use its formatting properties and display quality to optimize the effect of text display.
Font properties and
separatord7b Delete to the beginning of the first 7 words with spaces as separatorsD4) Delete to the end of the fourth statementD (Delete to the beginning of a statementd) Delete to the end of a statementd{Delete to the beginning of a paragraphnd{the nth paragraph position before the start position of the current paragraph is deletedD/text deletes the position of the typeface specified in the text from "text", moving forward until the next occurrence
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.