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

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

?? textlayout.java

?? 源碼為Eclipse開源開發平臺桌面開發工具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一区二区三区免费野_久草精品视频
日本中文字幕不卡| 欧美丰满少妇xxxxx高潮对白| 99riav一区二区三区| 欧美视频在线播放| 国产亚洲女人久久久久毛片| 一区二区三区欧美| 国产成人超碰人人澡人人澡| 亚洲精品在线网站| 日韩中文欧美在线| 日本韩国欧美在线| 国产精品乱码久久久久久| 日本中文字幕一区二区视频| 欧美在线影院一区二区| 欧美国产一区在线| 国产一区二区伦理| 在线播放视频一区| 亚洲一二三区不卡| 91视频国产资源| 中文字幕欧美日本乱码一线二线| 免费在线一区观看| 欧美日韩国产一级| 亚洲日本在线看| va亚洲va日韩不卡在线观看| 亚洲精品一线二线三线| 欧美aaa在线| 欧美一级精品在线| 天天影视色香欲综合网老头| 欧美午夜宅男影院| 一区二区三区不卡在线观看| 97se亚洲国产综合在线| 国产精品的网站| 国产精品资源网| 亚洲综合免费观看高清完整版 | 丰满岳乱妇一区二区三区| 日韩欧美在线观看一区二区三区| 亚洲国产精品久久久久秋霞影院| 色欧美88888久久久久久影院| 1024国产精品| 色综合天天在线| 亚洲午夜一区二区| 欧美日韩一二三| 日本中文字幕不卡| 久久综合色8888| 国产iv一区二区三区| 欧美国产乱子伦| 91国偷自产一区二区三区观看| 亚洲乱码中文字幕| 欧美性受xxxx| 麻豆精品在线视频| 国产网站一区二区三区| 97精品视频在线观看自产线路二| 亚洲免费在线观看| 欧美日韩国产综合一区二区| 日韩精品一卡二卡三卡四卡无卡| 1024亚洲合集| 欧美欧美午夜aⅴ在线观看| 污片在线观看一区二区| 精品久久一区二区三区| 成人午夜激情视频| 亚洲一区二区欧美| 精品国内片67194| 99麻豆久久久国产精品免费优播| 亚洲综合男人的天堂| 日韩一级片在线观看| 成人免费观看av| 性做久久久久久免费观看欧美| ww久久中文字幕| 色婷婷精品大在线视频| 欧美在线观看一区| 亚洲欧美色一区| 欧美日韩精品系列| 蜜臀av一区二区三区| 中文字幕精品一区二区精品绿巨人 | 欧美性猛交xxxx黑人交| 国产一区二区日韩精品| 亚洲欧美一区二区三区国产精品 | 白白色亚洲国产精品| 亚洲一区二区三区小说| 26uuu国产在线精品一区二区| 99国产精品久久久久久久久久| 天堂久久一区二区三区| 国产精品毛片久久久久久| 欧美精品一级二级三级| aaa亚洲精品| 国产在线观看一区二区| 亚洲高清不卡在线观看| 国产亚洲1区2区3区| 欧美亚洲动漫另类| 不卡视频免费播放| 国产专区综合网| 青青草国产成人99久久| 玉米视频成人免费看| 国产精品久久一级| 日韩精品一区二区三区在线播放 | 岛国av在线一区| 日本网站在线观看一区二区三区| 一区二区三区中文免费| 国产精品嫩草影院com| 26uuu久久综合| 日韩一二在线观看| 欧美日韩美女一区二区| 91成人在线观看喷潮| 99视频超级精品| 国产99久久久国产精品免费看| 麻豆精品国产91久久久久久| 亚洲综合成人在线| 亚洲乱码中文字幕综合| 蜜桃av一区二区在线观看| 夜夜夜精品看看| 综合色中文字幕| 国产精品久久久一本精品| 中日韩av电影| 中文无字幕一区二区三区 | 丁香桃色午夜亚洲一区二区三区| 美女视频一区二区| 蜜臀久久久久久久| 日韩av一二三| 久久精品国产99国产精品| 秋霞电影一区二区| 蜜桃av噜噜一区| 另类调教123区| 久久99国内精品| 国产一区二区三区蝌蚪| 国产91高潮流白浆在线麻豆| 国产98色在线|日韩| 成人av片在线观看| 日本久久电影网| 欧美日韩一本到| 日韩视频免费直播| 精品国产一区二区在线观看| 欧美mv日韩mv国产网站app| 精品国产一区二区三区四区四| 久久精品视频网| 亚洲视频一二区| 日韩电影免费一区| 精品在线一区二区三区| 国产不卡免费视频| 91在线视频网址| 欧美日韩成人在线| 久久综合九色综合欧美98| 亚洲天堂精品视频| 热久久一区二区| 成人的网站免费观看| 欧美色爱综合网| 久久久亚洲午夜电影| 亚洲乱码日产精品bd| 免费观看91视频大全| 成人动漫一区二区| 欧美夫妻性生活| 久久久久久免费毛片精品| 亚洲综合区在线| 国产传媒一区在线| 欧美综合在线视频| 欧美岛国在线观看| 亚洲精品自拍动漫在线| 国产一区不卡视频| 欧美日韩一卡二卡| 国产欧美日韩三级| 三级一区在线视频先锋| av高清不卡在线| 日韩亚洲欧美一区| 亚洲色图色小说| 久久国产乱子精品免费女| 老司机精品视频在线| av在线免费不卡| 色综合久久六月婷婷中文字幕| 日韩精品一区二区三区中文不卡| 国产精品久久久久天堂| 香蕉成人伊视频在线观看| 不卡的av中国片| 91精品国产综合久久久久久漫画| 久久久久久久久免费| 日韩电影在线观看网站| 成人av影院在线| 日韩精品一区二| 亚洲综合激情网| 91麻豆国产自产在线观看| 日韩一级片在线播放| 亚洲人123区| 另类的小说在线视频另类成人小视频在线| 在线观看日韩av先锋影音电影院| 26uuu国产日韩综合| 亚洲已满18点击进入久久| 国产精品一二三在| 欧美一区日韩一区| 亚洲视频一二三| 国产精品 日产精品 欧美精品| 91精品国产91综合久久蜜臀| 亚洲欧洲日产国码二区| 国内精品不卡在线| 欧美zozo另类异族| 午夜视频在线观看一区二区 | 91视频免费观看| 久久久久久久国产精品影院| 日韩电影免费在线| 欧美午夜宅男影院| 国产精品国产三级国产普通话三级 | 91精品国产入口| 亚洲国产中文字幕在线视频综合| 成人av在线播放网站|