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

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

?? usplib.c

?? 支持Unicode及Uniscribe的多語言輸入的文本編輯器源碼。
?? C
?? 第 1 頁 / 共 2 頁
字號:
			uspData->widthList	 = realloc(uspData->widthList,	 uspData->glyphAllocLen * sizeof(int));
			uspData->svaList     = realloc(uspData->svaList,	 uspData->glyphAllocLen * sizeof(SCRIPT_VISATTR));
		}

		//
		//	Convert the unicode-text into an array of glyphs
		//
		hr = ScriptShape(
			hdc,
			&uspFont->scriptCache, 
			wrunstr, 
			itemRun->len, 
			uspData->glyphAllocLen - uspData->glyphCount, 
			&itemRun->analysis, 
			uspData->glyphList		+ itemRun->glyphPos,
			uspData->clusterList	+ itemRun->charPos,		// already allocated in UspAnalyze
			uspData->svaList		+ itemRun->glyphPos,
			&itemRun->glyphCount
			);
	
		// no glyphs in the font - try again
		if(hr == USP_E_SCRIPT_NOT_IN_FONT)
		{
			itemRun->analysis.eScript = SCRIPT_UNDEFINED;
		}
		// unknown failure
		else if(hr != S_OK && hr != E_OUTOFMEMORY)
		{
			SelectObject(hdc, holdFont);
			return FALSE;
		}

	} while(hr != S_OK);

	// expand the glyph-list to include this item-run
	uspData->glyphCount += itemRun->glyphCount;


	//
	//	Generate glyph advance-widths for this run
	//
	ScriptPlace(
		hdc,
		&uspFont->scriptCache,
		uspData->glyphList	+ itemRun->glyphPos,
		itemRun->glyphCount,
		uspData->svaList	+ itemRun->glyphPos,
		&itemRun->analysis, 
		uspData->widthList	+ itemRun->glyphPos,
		uspData->offsetList	+ itemRun->glyphPos,
		&abc
		);

	// 
	//	Control-characters require special handling
	//
	if(itemRun->ctrl && itemRun->chcode != '\t')
	{
		// chcode is only valid for control-characters
		int chwidth = CtrlCharWidth(uspFont, hdc, itemRun->chcode);
		
		uspData->widthList[itemRun->glyphPos]	= chwidth;
		itemRun->width							= chwidth;
	}
	else
	{
		// remember the item-run width
		itemRun->width = abc.abcA + abc.abcB + abc.abcC;
	}

	// restore the font
	SelectObject(hdc, holdFont);
	return TRUE;
}

//
//	Remember the selection-state of an ITEM_RUN:
//
//	0 - no characters selected
//  1 - all characters selected
//  2 - some characters selected
//
//	This is a useful optimization used for drawing - under some
//  circumstances, an ITEM_RUN can be skipped if it's neighbouring
//  runs share the same selection-state
//
static
void IdentifyRunSelections(USPDATA *uspData, ITEM_RUN *itemRun)
{
	int c;
	int numsel = 0;
	
	// analyze run to see which characters are selected
	for(c = itemRun->charPos; c < itemRun->charPos + itemRun->len; c++)
		if(uspData->attrList[c].sel)
			numsel++;

	// set the selection state accordingly
	if(numsel == 0)					itemRun->selstate = 0;
	else if(numsel == itemRun->len)	itemRun->selstate = 1;
	else							itemRun->selstate = 2;
}

//
//	Update the USPDATA with a new attribute-run-list.
//
//	The font-information stored in ATTR::font is ignored, as are
//  the ::ctrl and ::eol flags
//
VOID WINAPI UspApplyAttributes(USPDATA *uspData, ATTR *attrRunList)
{
	int i, a, c=0;

	//
	//	'Flatten' the user-supplied attribute-run-list to an array
	//	of single ATTR structures, each 1-unit long.
	//
	for(a = 0, i = 0; i < uspData->stringLen; i++)
	{
		uspData->attrList[i]		= attrRunList[a];
		uspData->attrList[i].len	= 1;

		if(++c == attrRunList[a].len)
		{
			a++;
			c = 0;
		}
	}

	//	Identify the selection state of each run (none,all,partial)
	for(i = 0; i < uspData->itemRunCount; i++)
	{
		IdentifyRunSelections(uspData, &uspData->itemRunList[i]);
	}
}

//
//	Update USPDATA with new selection information - only modify
//	the ATTR::sel values within our internal attribute-list
//  (i.e. leave all other text styles untouched)
//
VOID WINAPI UspApplySelection(USPDATA *uspData, int selStart, int selEnd)
{
	int i,p;

	if(selStart >= selEnd)
	{
		int t = selStart;
		selStart = selEnd;
		selEnd   = t;
	}

	for(i = 0; i < uspData->itemRunCount; i++)
	{
		ITEM_RUN *itemRun = &uspData->itemRunList[i];

		for(p = itemRun->charPos; p < itemRun->charPos + itemRun->len; p++)
			uspData->attrList[p].sel = (p >= selStart && p < selEnd);

		IdentifyRunSelections(uspData, itemRun);
	}
}

//
//	Initialize the USPDATA line-state with a new text-string,
//  and an optional attribute-run-list. We reuse any previously
//  allocated arrays in the USPDATA structure, minimizing heap-access
//
//	*attrRunList can be NULL, in which case the line of text is initialized
//	with the default Windows text-colours and with font#0.
//	Otherwise, attrRunList is expected to describe a range of text the
//	same length as the text-input buffer.
//
//	*uspFontList can also be NULL, in which case the currently selected font
//	is used to shape the text. This same font *must* be reselected into
//	the device context when UspTextOut is called.
//
//	Any change to the fonts in uspFontList requires UspAnalyze to be called again.
//
BOOL WINAPI UspAnalyze (
		USPDATA			* uspData, 
		HDC				  hdc, 
		WCHAR			* wstr, 
		int				  wlen, 
		ATTR			* attrRunList, 
		UINT			  flags, 
		USPFONT			* uspFontList,
		SCRIPT_CONTROL	* scriptControl,
		SCRIPT_STATE	* scriptState,
		SCRIPT_TABDEF   * scriptTabdef
	)
{
	ATTR	defAttr;
	int		itemRunAllocLen;
	int		i;

	if(uspData == 0)
		return FALSE;

	// reset the lists
	uspData->itemRunCount	= 0;
	uspData->glyphCount		= 0;
	uspData->uspFontList	= uspFontList;
	uspData->stringLen		= wlen;

	// nothing to do?
	if(wstr == 0 || wlen == 0)
		return TRUE;

	// remember current allocation-size of itemRunList
	itemRunAllocLen = uspData->itemRunAllocLen;

	// use the default font if no user-supplied list
	if(uspFontList == 0)
	{
		uspData->defaultFont.hFont = 0;
		uspData->uspFontList = &uspData->defaultFont;
	}

	//
	// if no attributes specified then default to a single span
	// covering the entire length of the text
	//
	if(attrRunList == 0)
	{
		// create the default attribute
		defAttr.fg		= GetSysColor(COLOR_WINDOWTEXT);
		defAttr.bg		= GetSysColor(COLOR_WINDOW);
		defAttr.font	= 0;
		defAttr.sel		= 0;
		defAttr.ctrl	= 0;
		defAttr.eol		= 0;
		defAttr.len		= wlen;

		attrRunList		= &defAttr;
	}

	//
	//	Build a list of runs by calling ScriptItemize and merging
	//  those spans with the attribute-list. When BuildMergedItemRunList
	//  returns, the itemRunList array has been stored in uspData
	//
	if(!BuildMergedItemRunList(
				uspData,
				wstr, 
				wlen, 
				attrRunList,
				scriptControl,
				scriptState)
		)
	{
		return FALSE;
	}
 
	//	reallocate BIDI-arrays if item-run-list changed size
	if(itemRunAllocLen < uspData->itemRunAllocLen)
	{
		uspData->bidiLevels	= realloc(uspData->bidiLevels, uspData->itemRunAllocLen * sizeof(BYTE));
		uspData->visualToLogicalList = realloc(uspData->visualToLogicalList, uspData->itemRunAllocLen * sizeof(int));
	}

	//	Analyze the resulting runlist and build the BIDI-level array	
	if(!BuildVisualMapping( uspData->itemRunList, 
							uspData->itemRunCount, 
							uspData->bidiLevels,
							uspData->visualToLogicalList)
			)
	{
		return FALSE;
	}

	// Rellocate logical cluster+attribute arrays prior to shaping
	if(uspData->stringAllocLen < wlen)
	{
		uspData->stringAllocLen = wlen;
		uspData->clusterList	= realloc(uspData->clusterList,	wlen * sizeof(WORD));
		uspData->attrList		= realloc(uspData->attrList,	wlen * sizeof(ATTR));
		uspData->breakList		= realloc(uspData->breakList,	wlen * sizeof(SCRIPT_LOGATTR));
	}

	// Generate the word-break information in logical order
	for(i = 0; i < uspData->itemRunCount; i++)
	{
		ITEM_RUN *itemRun = &uspData->itemRunList[i];

		ScriptBreak(
				wstr + itemRun->charPos, 
				itemRun->len, 
				&itemRun->analysis, 
				uspData->breakList + itemRun->charPos
			);
	}

	// Perform shaping + generate glyph data
	for(i = 0; i < uspData->itemRunCount; i++)
	{
		ITEM_RUN *itemRun = GetItemRun(uspData, i);//;//&uspData->itemRunList[i];	//

		ShapeAndPlaceItemRun(
				uspData, 
				itemRun, 
				hdc, 
				wstr + itemRun->charPos
			);
	}

	//
	// locate tab-characters and expand the corresponding glyph-widths appropriately.
	// this must happen after *all* shaping/widths have been generated
	//
	if(scriptTabdef)
	{
		if(ExpandTabs(uspData, wstr, wlen, scriptTabdef))
		{
			// modify the SCRIPT_LOGATTR list to make tabs whitespace
			for(i = 0; i < wlen; i++)
			{
				if(wstr[i] == '\t')
					uspData->breakList[i].fWhiteSpace = TRUE;
			}
		}
		else
		{
			return FALSE;
		}
	}


	//
	//	Keep a flattened copy of the attribute-run-list, but 
	//	with one element per character rather than larger runs.
	//
	UspApplyAttributes(uspData, attrRunList);

	return TRUE;
}

//
//	Create the control structure
//
USPDATA * WINAPI UspAllocate()
{
	USPDATA *uspData = malloc(sizeof(USPDATA));

	if(uspData)
	{
		// set all members to zero including run-counts etc
		memset(uspData, 0, sizeof(USPDATA));

		uspData->selFG = GetSysColor(COLOR_HIGHLIGHTTEXT);
		uspData->selBG = GetSysColor(COLOR_HIGHLIGHT);
	}
		
	return uspData;
}

//
//	Free everything
//
VOID WINAPI UspFree(USPDATA *uspData)
{
	if(uspData)
	{
		// free the script-cache (will be NULL if a user-supplied fontlist was specified)
		ScriptFreeCache(&uspData->defaultFont.scriptCache);

		// free the glyph-buffers
		free(uspData->glyphList);
		free(uspData->svaList);
		free(uspData->widthList);
		free(uspData->offsetList);
		
		// free the item-run buffers
		free(uspData->itemRunList);
		free(uspData->visualToLogicalList);
		free(uspData->bidiLevels);
		free(uspData->tempItemList);
		
		// free the logical character-buffers
		free(uspData->clusterList);
		free(uspData->attrList);

		// free the control structure
		free(uspData);
	}
}

BOOL WINAPI UspGetSize(USPDATA *uspData, SIZE * size)
{
	int i;
	
	size->cx = 0;
	size->cy = 0;

	for(i = 0; i < uspData->itemRunCount; i++)
	{
		size->cx += uspData->itemRunList[i].width;
	}

	return TRUE;
}

SCRIPT_LOGATTR * WINAPI UspGetLogAttr(USPDATA *uspData)
{
	if(uspData && uspData->breakList)
	{
		return uspData->breakList;
	}
	else
	{
		return NULL;
	}
}

BOOL WINAPI UspBuildAttr (
		ATTR	  *	attr,
		COLORREF    colfg,	
		COLORREF    colbg,
		int			len,
		int			font,
		int			sel,
		int			ctrl,
		int			eol
	)
{
	if(attr == 0)
		return FALSE;

	attr->fg		= colfg;
	attr->bg		= colbg;
	attr->len		= len;
	attr->font		= font;
	attr->sel		= sel;
	attr->ctrl		= ctrl;
	attr->eol		= eol;
	attr->reserved	= 0;

	return TRUE;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本一区二区三区dvd视频在线| 中文无字幕一区二区三区 | 久久精品国产久精国产爱| 丝袜美腿成人在线| 成人免费看黄yyy456| 欧美日本精品一区二区三区| 国产清纯美女被跳蛋高潮一区二区久久w| 日韩美女视频一区二区| 久久成人免费网站| 欧美日韩二区三区| 国产精品免费免费| 国产精品一二二区| 欧美变态口味重另类| 亚洲国产精品麻豆| 99精品热视频| 国产精品美日韩| 国产传媒久久文化传媒| 欧美变态口味重另类| 久久99国产乱子伦精品免费| 欧美中文字幕不卡| 国产精品久久久久aaaa樱花 | 亚洲三级在线播放| 国产成人aaa| 久久久五月婷婷| 看片的网站亚洲| 777a∨成人精品桃花网| 亚洲一区二区高清| 在线观看亚洲精品| 亚洲女人****多毛耸耸8| 99综合电影在线视频| 国产欧美日产一区| 岛国精品在线播放| 国产午夜亚洲精品午夜鲁丝片| 激情综合一区二区三区| 欧美成人综合网站| 激情国产一区二区| 国产亚洲精品免费| 福利一区在线观看| 综合久久国产九一剧情麻豆| av一区二区三区在线| 中文字幕一区二区视频| 99r国产精品| 亚洲制服丝袜一区| 欧美日韩日日摸| 午夜精品视频在线观看| 制服丝袜亚洲网站| 久久国产麻豆精品| 国产亚洲欧美一区在线观看| caoporn国产精品| 日韩理论片网站| 欧美性videosxxxxx| 婷婷综合另类小说色区| 精品久久五月天| 国产91在线观看| 亚洲乱码中文字幕综合| 欧美理论在线播放| 国产一区二区三区综合| 国产精品美女久久久久av爽李琼| 91伊人久久大香线蕉| 五月婷婷激情综合| 久久综合色8888| 97精品久久久午夜一区二区三区 | 精品亚洲国产成人av制服丝袜 | 亚洲免费观看高清完整| 欧美军同video69gay| 久久se精品一区精品二区| 中文幕一区二区三区久久蜜桃| 在线观看日韩毛片| 美国毛片一区二区三区| 国产精品二三区| 51午夜精品国产| 成人高清视频在线观看| 日韩成人一区二区三区在线观看| 国产亚洲综合在线| 欧美在线观看视频一区二区| 精品一区二区三区日韩| 亚洲乱码国产乱码精品精的特点 | 日韩精品一二三区| 国产日韩欧美激情| 欧美电影一区二区三区| 成人蜜臀av电影| 美女一区二区在线观看| 亚洲欧美日韩人成在线播放| 日韩免费成人网| 欧美自拍偷拍一区| 大桥未久av一区二区三区中文| 日欧美一区二区| 最新成人av在线| 久久久久99精品国产片| 91精品在线免费观看| 91色婷婷久久久久合中文| 韩国成人在线视频| 日本视频一区二区| 亚洲美女电影在线| 中文字幕第一页久久| 欧美成人国产一区二区| 欧美久久久久久久久| 91丨porny丨首页| 国产91高潮流白浆在线麻豆| 久久国产精品无码网站| 日韩专区一卡二卡| 亚洲综合一区二区精品导航| 中国色在线观看另类| 26uuu国产一区二区三区| 884aa四虎影成人精品一区| 在线亚洲一区二区| 成人黄色777网| 丁香一区二区三区| 国产乱一区二区| 国产在线精品视频| 极品销魂美女一区二区三区| 久久国产精品无码网站| 美女在线一区二区| 日本视频中文字幕一区二区三区| 丝袜美腿亚洲一区| 日本中文一区二区三区| 日韩电影在线免费看| 日韩国产一二三区| 欧美aaa在线| 麻豆精品一区二区三区| 蜜臀av一级做a爰片久久| 美女视频第一区二区三区免费观看网站 | 高清shemale亚洲人妖| 国产成人亚洲精品狼色在线| 国产成人在线色| 成人一区二区在线观看| 91在线精品一区二区三区| 91美女福利视频| 在线视频欧美精品| 欧美日韩日本视频| 日韩一级完整毛片| 久久综合九色欧美综合狠狠| 国产女主播一区| 亚洲少妇中出一区| 亚洲va欧美va人人爽午夜 | 欧美军同video69gay| 日韩一区二区三区视频在线观看| 欧美不卡激情三级在线观看| 国产丝袜在线精品| 亚洲免费成人av| 日本不卡免费在线视频| 国产精品原创巨作av| 99re成人精品视频| 欧美日韩精品欧美日韩精品| 精品久久久久久无| 国产精品高潮久久久久无| 亚洲一区二区三区四区在线观看 | 亚洲免费观看高清在线观看| 亚洲综合色区另类av| 精品一区二区三区免费播放| 不卡视频在线观看| 在线不卡的av| 国产精品视频你懂的| 午夜视频一区二区三区| 国产精品一区二区黑丝| 91成人免费在线视频| 久久久亚洲欧洲日产国码αv| 最近日韩中文字幕| 另类综合日韩欧美亚洲| 91啪在线观看| 欧美不卡视频一区| 亚洲在线免费播放| 国产精品99精品久久免费| 欧美私模裸体表演在线观看| 久久久久成人黄色影片| 婷婷六月综合网| av在线这里只有精品| 日韩一区二区在线观看视频播放| 亚洲天堂a在线| 激情综合网天天干| 欧美日韩大陆在线| 中文字幕佐山爱一区二区免费| 另类小说欧美激情| 91精品1区2区| 国产精品久久久久9999吃药| 久久99精品一区二区三区三区| 在线视频你懂得一区| 国产精品国产三级国产aⅴ中文 | 亚洲一区二区三区影院| 成人在线综合网站| 欧美大片在线观看| 日产精品久久久久久久性色| 色婷婷综合五月| 亚洲国产精品二十页| 激情综合网av| 欧美大白屁股肥臀xxxxxx| 亚洲国产精品欧美一二99| 一本高清dvd不卡在线观看| 欧美激情一区二区三区在线| 久久精品国产网站| 91麻豆精品国产91久久久久久| 一个色妞综合视频在线观看| 99久久精品一区| 中文字幕一区二区三中文字幕| 国产高清不卡一区| 国产色爱av资源综合区| 精品一区二区三区蜜桃| 亚洲精品一区二区三区蜜桃下载 | 亚洲综合自拍偷拍| 一本久道中文字幕精品亚洲嫩|