亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? textlayout.java

?? 源碼為Eclipse開源開發(fā)平臺桌面開發(fā)工具SWT的源代碼,
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
/******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html *  * Contributors: *     IBM Corporation - initial API and implementation *******************************************************************************/package org.eclipse.swt.graphics;import org.eclipse.swt.internal.*;import org.eclipse.swt.internal.win32.*;import org.eclipse.swt.*;/** * <code>TextLayout</code> is a graphic object that represents * styled text. *<p> * Instances of this class provide support for drawing, cursor * navigation, hit testing, text wrapping, alignment, tab expansion * line breaking, etc.  These are aspects required for rendering internationalized text. * </p> *  * <p> * Application code must explicitly invoke the <code>TextLayout#dispose()</code>  * method to release the operating system resources managed by each instance * when those instances are no longer required. * </p> *  *  @since 3.0 */public final class TextLayout {	Device device;	Font font;	String text, segmentsText;	int lineSpacing;	int ascent, descent;	int alignment;	int wrapWidth;	int orientation;	int[] tabs;	int[] segments;	StyleItem[] styles;	StyleItem[] allRuns;	StyleItem[][] runs;	int[] lineOffset, lineY, lineWidth;		static final char LTR_MARK = '\u200E', RTL_MARK = '\u200F';		static final int SCRIPT_VISATTR_SIZEOF = 2;	static final int GOFFSET_SIZEOF = 8;		static class StyleItem {		TextStyle style;		int start, length;		boolean lineBreak, softBreak, tab;					/*Script cache and analysis */		SCRIPT_ANALYSIS analysis;		int psc = 0;				/*Shape info (malloc when the run is shaped) */		int glyphs;		int glyphCount;		int clusters;		int visAttrs;				/*Place info (malloc when the run is placed) */		int advances;		int goffsets;		int width;		int ascent;		int descent;		/* ScriptBreak */		int psla;		int fallbackFont;		void free() {		int hHeap = OS.GetProcessHeap();		if (psc != 0) {			OS.ScriptFreeCache (psc);			OS.HeapFree(hHeap, 0, psc);			psc = 0;		}		if (glyphs != 0) {			OS.HeapFree(hHeap, 0, glyphs);			glyphs = 0;			glyphCount = 0;		}		if (clusters != 0) {			OS.HeapFree(hHeap, 0, clusters);			clusters = 0;		}		if (visAttrs != 0) {			OS.HeapFree(hHeap, 0, visAttrs);			visAttrs = 0;		}		if (advances != 0) {			OS.HeapFree(hHeap, 0, advances);			advances = 0;		}				if (goffsets != 0) {			OS.HeapFree(hHeap, 0, goffsets);			goffsets = 0;		}		if (psla != 0) {			OS.HeapFree(hHeap, 0, psla);			psla = 0;		}		if (fallbackFont != 0) {			OS.DeleteObject(fallbackFont);			fallbackFont = 0;		}		width = ascent = descent = 0;		lineBreak = softBreak = false;			}	}/**	  * Constructs a new instance of this class on the given device. * <p> * You must dispose the text layout when it is no longer required.  * </p> *  * @param device the device on which to allocate the text layout *  * @exception IllegalArgumentException <ul> *    <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li> * </ul> *  * @see #dispose() */public TextLayout (Device device) {	if (device == null) device = Device.getDevice();	if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);	this.device = device;	wrapWidth = ascent = descent = -1;	lineSpacing = 0;	orientation = SWT.LEFT_TO_RIGHT;	styles = new StyleItem[2];	styles[0] = new StyleItem();	styles[1] = new StyleItem();	text = ""; //$NON-NLS-1$	if (device.tracking) device.new_Object(this);}void breakRun(StyleItem run) {	if (run.psla != 0) return;	char[] chars = new char[run.length];	segmentsText.getChars(run.start, run.start + run.length, chars, 0);	int hHeap = OS.GetProcessHeap();	run.psla = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, SCRIPT_LOGATTR.sizeof * chars.length); 	OS.ScriptBreak(chars, chars.length, run.analysis, run.psla);}void checkLayout () {	if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);}/* *  Compute the runs: itemize, shape, place, and reorder the runs.* 	Break paragraphs into lines, wraps the text, and initialize caches.*/void computeRuns (GC gc) {	if (runs != null) return;	int hDC = gc != null ? gc.handle : device.internal_new_GC(null);	int srcHdc = OS.CreateCompatibleDC(hDC);	allRuns = itemize();	for (int i=0; i<allRuns.length - 1; i++) {		StyleItem run = allRuns[i];		OS.SelectObject(srcHdc, getItemFont(run));		shape(srcHdc, run);	}	SCRIPT_LOGATTR logAttr = new SCRIPT_LOGATTR();	SCRIPT_PROPERTIES properties = new SCRIPT_PROPERTIES();	int lineWidth = 0, lineStart = 0, lineCount = 1;	for (int i=0; i<allRuns.length - 1; i++) {		StyleItem run = allRuns[i];		if (run.length == 1) {			char ch = segmentsText.charAt(run.start);			switch (ch) {				case '\t': {					run.tab = true;					if (tabs == null) break;					int tabsLength = tabs.length, j;					for (j = 0; j < tabsLength; j++) {						if (tabs[j] > lineWidth) {							run.width = tabs[j] - lineWidth;							break;						}					}					if (j == tabsLength) {						int tabX = tabs[tabsLength-1];						int lastTabWidth = tabsLength > 1 ? tabs[tabsLength-1] - tabs[tabsLength-2] : tabs[0];						if (lastTabWidth > 0) {							while (tabX <= lineWidth) tabX += lastTabWidth;							run.width = tabX - lineWidth;						}					}					break;				}				case '\n': {					run.lineBreak = true;					break;				}				case '\r': {					run.lineBreak = true;					StyleItem next = allRuns[i + 1];					if (next.length != 0 && segmentsText.charAt(next.start) == '\n') {						run.length += 1;						next.free();						i++;					}					break;				}			}		} 		if (wrapWidth != -1 && lineWidth + run.width > wrapWidth && !run.tab) {			int start = 0;			int[] piDx = new int[run.length];			OS.ScriptGetLogicalWidths(run.analysis, run.length, run.glyphCount, run.advances, run.clusters, run.visAttrs, piDx);			int width = 0, maxWidth = wrapWidth - lineWidth;			while (width + piDx[start] < maxWidth) {				width += piDx[start++];			}			int firstStart = start;			int firstIndice = i;			while (i >= lineStart) {				breakRun(run);				while (start >= 0) {					OS.MoveMemory(logAttr, run.psla + (start * SCRIPT_LOGATTR.sizeof), SCRIPT_LOGATTR.sizeof); 					if (logAttr.fSoftBreak || logAttr.fWhiteSpace) break;					start--;				}								/*				*  Bug in Windows. For some reason Uniscribe sets the fSoftBreak flag for the first letter				*  after a letter with an accent. This cause a break line to be set in the middle of a word.				*  The fix is to detect the case and ignore fSoftBreak forcing the algorithm keep searching.				*/				if (start == 0 && i != lineStart && !run.tab) {					if (logAttr.fSoftBreak && !logAttr.fWhiteSpace) {						OS.MoveMemory(properties, device.scripts[run.analysis.eScript], SCRIPT_PROPERTIES.sizeof);						int langID = properties.langid;						StyleItem pRun = allRuns[i - 1];						OS.MoveMemory(properties, device.scripts[pRun.analysis.eScript], SCRIPT_PROPERTIES.sizeof);						if (properties.langid == langID || langID == OS.LANG_NEUTRAL || properties.langid == OS.LANG_NEUTRAL) {							breakRun(pRun);							OS.MoveMemory(logAttr, pRun.psla + ((pRun.length - 1) * SCRIPT_LOGATTR.sizeof), SCRIPT_LOGATTR.sizeof); 							if (!logAttr.fWhiteSpace) start = -1;						}					}				}						if (start >= 0 || i == lineStart) break;				run = allRuns[--i];				start = run.length - 1;			}			if (start == 0 && i != lineStart && !run.tab) {				run = allRuns[--i];			} else 	if (start <= 0 && i == lineStart) {				i = firstIndice;				run = allRuns[i];				start = Math.max(1, firstStart);			}			breakRun(run);			while (start < run.length) {				OS.MoveMemory(logAttr, run.psla + (start * SCRIPT_LOGATTR.sizeof), SCRIPT_LOGATTR.sizeof); 				if (!logAttr.fWhiteSpace) break;				start++;			}			if (0 < start && start < run.length) {				StyleItem newRun = new StyleItem();				newRun.start = run.start + start;				newRun.length = run.length - start;				newRun.style = run.style;				newRun.analysis = run.analysis;				run.free();				run.length = start;				OS.SelectObject(srcHdc, getItemFont(run));				shape (srcHdc, run);				shape (srcHdc, newRun);				StyleItem[] newAllRuns = new StyleItem[allRuns.length + 1];				System.arraycopy(allRuns, 0, newAllRuns, 0, i + 1);				System.arraycopy(allRuns, i + 1, newAllRuns, i + 2, allRuns.length - i - 1);				allRuns = newAllRuns;				allRuns[i + 1] = newRun;			}			if (i != allRuns.length - 2) {				run.softBreak = run.lineBreak = true;			}		}		lineWidth += run.width;		if (run.lineBreak) {			lineStart = i + 1;			lineWidth = 0;			lineCount++;		}	}	lineWidth = 0;	runs = new StyleItem[lineCount][];	lineOffset = new int[lineCount + 1];	lineY = new int[lineCount + 1];	this.lineWidth = new int[lineCount];	int lineRunCount = 0, line = 0;	int ascent = Math.max(0, this.ascent);	int descent = Math.max(0, this.descent);	StyleItem[] lineRuns = new StyleItem[allRuns.length];	for (int i=0; i<allRuns.length; i++) {		StyleItem run = allRuns[i];		lineRuns[lineRunCount++] = run;		lineWidth += run.width;		ascent = Math.max(ascent, run.ascent);		descent = Math.max(descent, run.descent);		if (run.lineBreak || i == allRuns.length - 1) {			/* Update the run metrics if the last run is a hard break. */			if (lineRunCount == 1 && i == allRuns.length - 1) {				TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA();				OS.SelectObject(srcHdc, getItemFont(run));				OS.GetTextMetrics(srcHdc, lptm);				run.ascent = lptm.tmAscent;				run.descent = lptm.tmDescent;				ascent = Math.max(ascent, run.ascent);				descent = Math.max(descent, run.descent);			}			runs[line] = new StyleItem[lineRunCount];			System.arraycopy(lineRuns, 0, runs[line], 0, lineRunCount);			StyleItem lastRun = runs[line][lineRunCount - 1];			runs[line] = reorder(runs[line]);			this.lineWidth[line] = lineWidth;			line++;			lineY[line] = lineY[line - 1] + ascent + descent + lineSpacing;			lineOffset[line] = lastRun.start + lastRun.length;			lineRunCount = lineWidth = 0;			ascent = Math.max(0, this.ascent);			descent = Math.max(0, this.descent);		}	}	if (srcHdc != 0) OS.DeleteDC(srcHdc);	if (gc == null) device.internal_dispose_GC(hDC, null);	}/** * Disposes of the operating system resources associated with * the text layout. Applications must dispose of all allocated text layouts. */public void dispose () {	if (device == null) return;	freeRuns();	font = null;		text = null;	segmentsText = null;	tabs = null;	styles = null;	runs = null;	lineOffset = null;	lineY = null;	lineWidth = null;	if (device.tracking) device.dispose_Object(this);	device = null;}/** * Draws the receiver's text using the specified GC at the specified * point. *  * @param gc the GC to draw * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn * * @exception SWTException <ul> *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */public void draw (GC gc, int x, int y) {	draw(gc, x, y, -1, -1, null, null);}/** * Draws the receiver's text using the specified GC at the specified * point. *  * @param gc the GC to draw * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn * @param selectionStart the offset where the selections starts, or -1 indicating no selection * @param selectionEnd the offset where the selections ends, or -1 indicating no selection * @param selectionForeground selection foreground, or NULL to use the system default color * @param selectionBackground selection background, or NULL to use the system default color * * @exception SWTException <ul>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区四区av| 精品成人在线观看| 18涩涩午夜精品.www| 不卡一区中文字幕| 中文字幕一区二区三区在线不卡| 波多野结衣中文字幕一区| 国产精品久久久久影院亚瑟| 91在线观看视频| 亚洲一区在线观看网站| 9191成人精品久久| 久久激情五月激情| 国产精品天天看| 欧美中文字幕一区| 日本sm残虐另类| 国产日本欧洲亚洲| 色婷婷香蕉在线一区二区| 香蕉久久夜色精品国产使用方法| 91精品国产一区二区| 国产一区二区三区免费播放| 欧美高清在线一区二区| 在线国产亚洲欧美| 美女脱光内衣内裤视频久久网站| 日韩美女视频在线| 成人免费毛片高清视频| 亚洲va在线va天堂| 日本一区二区三区久久久久久久久不 | 日产国产高清一区二区三区| 日韩欧美二区三区| 99久久久无码国产精品| 日韩电影在线观看网站| 国产精品天美传媒| 欧美精品三级在线观看| 国产二区国产一区在线观看| 亚洲图片有声小说| 中文字幕不卡三区| 欧美成人一区二区三区| 不卡一区二区三区四区| 日本午夜一区二区| 中国av一区二区三区| 欧美亚洲免费在线一区| 成人毛片老司机大片| 蜜芽一区二区三区| 亚洲精品你懂的| 久久久影视传媒| 欧美二区三区的天堂| 99久久综合狠狠综合久久| 久久国产婷婷国产香蕉| 亚洲永久精品大片| 国产精品伦一区二区三级视频| 91精品国产综合久久香蕉麻豆 | 美女看a上一区| 亚洲精品国产视频| 国产拍揄自揄精品视频麻豆| 欧美一区二区不卡视频| 欧美三级蜜桃2在线观看| 成人毛片老司机大片| 国产制服丝袜一区| 日韩激情中文字幕| 怡红院av一区二区三区| 国产精品久久二区二区| 久久久久99精品一区| 日韩一区二区三区免费观看| 在线看一区二区| 色综合色狠狠天天综合色| 国产成人av一区二区| 久久国产精品99久久人人澡| 午夜精品久久一牛影视| 一区二区国产盗摄色噜噜| 成人欧美一区二区三区在线播放| 国产日韩高清在线| 久久先锋影音av| 久久久久久久久99精品| 欧美精品一区二区久久久| 日韩一区二区中文字幕| 欧美一二三区在线| 欧美一级欧美三级在线观看| 制服丝袜成人动漫| 91精品在线观看入口| 91精品国产一区二区三区 | 日韩一区二区三区四区五区六区| 精品婷婷伊人一区三区三| 欧美亚洲综合网| 欧美色涩在线第一页| 欧美日韩精品一区二区三区 | 国产偷v国产偷v亚洲高清| 精品久久一区二区三区| 精品久久久久香蕉网| 久久久国产精品麻豆| 久久久影视传媒| 国产精品久久久久一区| 亚洲三级在线免费观看| 亚洲一区二区三区在线播放| 亚洲电影你懂得| 麻豆一区二区三区| 国产一区二区三区免费播放| 成人免费av网站| 欧美怡红院视频| 在线成人小视频| 欧美大白屁股肥臀xxxxxx| 国产精品动漫网站| 亚洲电影你懂得| 国产综合色视频| 99re这里只有精品6| 欧美性猛片xxxx免费看久爱| 91精品国产乱码久久蜜臀| 久久免费精品国产久精品久久久久| 国产精品五月天| 午夜视黄欧洲亚洲| 激情综合网av| 一本到高清视频免费精品| 欧美精品久久99久久在免费线 | 亚洲人成精品久久久久久 | 一区二区三区av电影| 青青草国产精品97视觉盛宴| 国产激情视频一区二区在线观看| 成人久久视频在线观看| 欧美二区在线观看| 国产精品久久久久9999吃药| 日欧美一区二区| 国产麻豆视频一区| 欧美在线影院一区二区| 久久先锋资源网| 亚洲va在线va天堂| 成人免费视频视频在线观看免费| 欧美乱熟臀69xxxxxx| 中文字幕一区视频| 精品一区二区三区在线播放 | 日韩三级在线观看| 国产精品三级电影| 免费成人小视频| 91国产免费看| 国产精品国产三级国产| 久久国产剧场电影| 欧美日韩视频第一区| 国产精品欧美久久久久无广告| 天天av天天翘天天综合网色鬼国产| 国产成人福利片| 欧美二区乱c少妇| 亚洲一区日韩精品中文字幕| 成人精品gif动图一区| www国产精品av| 免费一级欧美片在线观看| 91国偷自产一区二区三区成为亚洲经典 | 国内精品伊人久久久久av影院 | 蜜臀精品一区二区三区在线观看 | 欧美电影免费观看高清完整版在线观看| 欧美国产欧美综合| 伦理电影国产精品| 欧美系列一区二区| 亚洲理论在线观看| 成人激情免费电影网址| 精品少妇一区二区三区在线播放| 亚洲一区二区三区不卡国产欧美| 91精品国产高清一区二区三区蜜臀| 亚洲人成网站色在线观看| 国产精品18久久久久| 欧美不卡123| 国产精品小仙女| 亚洲精品国产精品乱码不99| 国产精品一区二区你懂的| 91精品国产福利在线观看| 成人的网站免费观看| 九一久久久久久| 国产激情视频一区二区在线观看| 欧美日韩激情在线| 亚洲伊人色欲综合网| 在线看不卡av| 亚洲成a人片在线不卡一二三区| 91福利区一区二区三区| 一区二区三区四区不卡视频| 日本道免费精品一区二区三区| 亚洲手机成人高清视频| 一本色道a无线码一区v| 亚洲蜜臀av乱码久久精品蜜桃| 99久久免费精品高清特色大片| 亚洲美女视频在线| 91福利视频在线| 天天操天天干天天综合网| 日韩欧美亚洲一区二区| 麻豆精品蜜桃视频网站| 久久视频一区二区| 国产91在线看| 亚洲男女一区二区三区| 91老师片黄在线观看| 亚洲国产精品人人做人人爽| 欧美日本在线播放| 麻豆精品一区二区综合av| 久久综合久久综合久久| 国产成人免费高清| 国产精品久久毛片a| 在线观看网站黄不卡| 一区二区免费在线| 中文字幕在线观看不卡| 色偷偷一区二区三区| 亚洲123区在线观看| 欧美va亚洲va| 9i看片成人免费高清| 性感美女极品91精品| 久久婷婷综合激情| 日本电影欧美片|