请大神指点一下,duilib怎么实现阿拉伯语的从右到左的UI展示方式

凌乱哥 2021-03-08 05:12:01
文字、各种控件(按钮、编辑框、进度条、下拉框)要怎么设置,属性名叫什么,在网上都搜不到这样的资料
...全文
358 12 打赏 收藏 举报
写回复
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2021-03-16
这也能挖出来
  • 打赏
  • 举报
回复
凌乱哥 2021-03-16
引用 5 楼 赵4老师 的回复:
我的意思是windows api原生支持从右往左读的阿拉伯文。duilib如果不支持,直接绕过它。
偶然看到赵老师在多年以前就提出过这个问题,下面帖子的3L就有了 开源界面库SOUI的多语言动态切换及dpiaware支持demo
  • 打赏
  • 举报
回复
顾小白xx 2021-03-16
DUIlib 很多用的都是windows api 如果他没有现成的接口你就加一个,不至于重构把
  • 打赏
  • 举报
回复
如果你用C++Builder,VCL内置支持文字方向(BiDiMode)
  • 打赏
  • 举报
回复
赵4老师 2021-03-10
引用 6 楼 凌乱哥 的回复:
[quote=引用 5 楼 赵4老师 的回复:]我的意思是windows api原生支持从右往左读的阿拉伯文。duilib如果不支持,直接绕过它。
但是对于既有项目来说,绕过就无异于整体重构了。先看看有没有基于不改框架的方案[/quote] duilib是开源的,如果它不支持从右往左读的阿拉伯文,要不拜托您老受累给patch+update一下,给中阿共建一带一路添砖加瓦,给后辈造福,为万世开太平! 这就是传说中的“捧杀”吗?
  • 打赏
  • 举报
回复
凌乱哥 2021-03-10
引用 5 楼 赵4老师 的回复:
我的意思是windows api原生支持从右往左读的阿拉伯文。duilib如果不支持,直接绕过它。
但是对于既有项目来说,绕过就无异于整体重构了。先看看有没有基于不改框架的方案
  • 打赏
  • 举报
回复
凌乱哥 2021-03-10
引用 7 楼 赵4老师 的回复:
[quote=引用 6 楼 凌乱哥 的回复:][quote=引用 5 楼 赵4老师 的回复:]我的意思是windows api原生支持从右往左读的阿拉伯文。duilib如果不支持,直接绕过它。
但是对于既有项目来说,绕过就无异于整体重构了。先看看有没有基于不改框架的方案[/quote] duilib是开源的,如果它不支持从右往左读的阿拉伯文,要不拜托您老受累给patch+update一下,给中阿共建一带一路添砖加瓦,给后辈造福,为万世开太平! 这就是传说中的“捧杀”吗? [/quote] 这事我干不了,也不想干
  • 打赏
  • 举报
回复
赵4老师 2021-03-09
我的意思是windows api原生支持从右往左读的阿拉伯文。duilib如果不支持,直接绕过它。
  • 打赏
  • 举报
回复
凌乱哥 2021-03-09
引用 1 楼 赵4老师 的回复:
ExtTextOut
引用 2 楼 赵4老师 的回复:
SetTextAlign
引用 3 楼 赵4老师 的回复:
CreateFont
感谢赵4老师的支持,我觉得你已经尽力了,但是对我的问题没什么实际的作用,还是谢谢你
  • 打赏
  • 举报
回复
赵4老师 2021-03-08
CreateFont The CreateFont function creates a logical font that has specific characteristics. The logical font can subsequently be selected as the font for any device. HFONT CreateFont( int nHeight, // logical height of font int nWidth, // logical average character width int nEscapement, // angle of escapement int nOrientation, // base-line orientation angle int fnWeight, // font weight DWORD fdwItalic, // italic attribute flag DWORD fdwUnderline, // underline attribute flag DWORD fdwStrikeOut, // strikeout attribute flag DWORD fdwCharSet, // character set identifier DWORD fdwOutputPrecision, // output precision DWORD fdwClipPrecision, // clipping precision DWORD fdwQuality, // output quality DWORD fdwPitchAndFamily, // pitch and family LPCTSTR lpszFace // pointer to typeface name string ); Parameters …… fdwCharSet Specifies the character set. The following values are predefined: ANSI_CHARSET BALTIC_CHARSET CHINESEBIG5_CHARSET DEFAULT_CHARSET EASTEUROPE_CHARSET GB2312_CHARSET GREEK_CHARSET HANGUL_CHARSET MAC_CHARSET OEM_CHARSET RUSSIAN_CHARSET SHIFTJIS_CHARSET SYMBOL_CHARSET TURKISH_CHARSET Korean Windows: JOHAB_CHARSET Middle-Eastern Windows: HEBREW_CHARSET ARABIC_CHARSET Thai Windows: THAI_CHARSET The OEM_CHARSET value specifies a character set that is operating-system dependent. You can use the DEFAULT_CHARSET value to allow the name and size of a font to fully describe the logical font. If the specified font name does not exist, a font from any character set can be substituted for the specified font, so you should use DEFAULT_CHARSET sparingly to avoid unexpected results. Fonts with other character sets may exist in the operating system. If an application uses a font with an unknown character set, it should not attempt to translate or interpret strings that are rendered with that font. This parameter is important in the font mapping process. To ensure consistent results, specify a specific character set. If you specify a typeface name in the lpszFace parameter, make sure that the fdwCharSet value matches the character set of the typeface specified in lpszFace. ……
  • 打赏
  • 举报
回复
赵4老师 2021-03-08
SetTextAlign The SetTextAlign function sets the text-alignment flags for the specified device context. UINT SetTextAlign( HDC hdc, // handle to device context UINT fMode // text-alignment flag ); Parameters hdc Handle to the device context. fMode Specifies the text alignment by using a mask of the values in the following list. Only one flag can be chosen from those that affect horizontal and vertical alignment. In addition, only one of the two flags that alter the current position can be chosen. Value Meaning TA_BASELINE The reference point will be on the base line of the text. TA_BOTTOM The reference point will be on the bottom edge of the bounding rectangle. TA_TOP The reference point will be on the top edge of the bounding rectangle. TA_CENTER The reference point will be aligned horizontally with the center of the bounding rectangle. TA_LEFT The reference point will be on the left edge of the bounding rectangle. TA_RIGHT The reference point will be on the right edge of the bounding rectangle. TA_NOUPDATECP The current position is not updated after each text output call. The reference point is passed to the text output function. TA_RTLREADING Middle-Eastern Windows: The text is laid out in right to left reading order, as opposed to the default left to right order. This applies only when the font selected into the device context is either Hebrew or Arabic. TA_UPDATECP The current position is updated after each text output call. The current position is used as the reference point. When the current font has a vertical default base line, as with Kanji, the following values must be used instead of TA_BASELINE and TA_CENTER: Value Meaning VTA_BASELINE The reference point will be on the base line of the text. VTA_CENTER The reference point will be aligned vertically with the center of the bounding rectangle. The default values are TA_LEFT, TA_TOP, and TA_NOUPDATECP. Return Values If the function succeeds, the return value is the previous text-alignment setting. If the function fails, the return value is GDI_ERROR. Windows NT: To get extended error information, callGetLastError. Remarks The TextOut and ExtTextOut functions use the text-alignment flags to position a string of text on a display or other device. The flags specify the relationship between a reference point and a rectangle that bounds the text. The reference point is either the current position or a point passed to a text output function. The rectangle that bounds the text is formed by the character cells in the text string. QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Unsupported. Header: Declared in wingdi.h. Import Library: Use gdi32.lib. See Also Fonts and Text Overview, Font and Text Functions, ExtTextOut, GetTextAlign, TextOut
  • 打赏
  • 举报
回复
赵4老师 2021-03-08
ExtTextOut The ExtTextOut function draws a character string by using the currently selected font, background color, and text color. An optional rectangle may be provided, to be used for clipping, opaquing, or both. BOOL ExtTextOut( HDC hdc, // handle to device context int X, // x-coordinate of reference point int Y, // y-coordinate of reference point UINT fuOptions, // text-output options CONST RECT *lprc, // optional clipping and/or opaquing rectangle LPCTSTR lpString, // points to string UINT cbCount, // number of characters in string CONST INT *lpDx // pointer to array of intercharacter spacing // values ); Parameters hdc Handle to the device context. X Specifies the logical x-coordinate of the reference point used to position the string. Y Specifies the logical y-coordinate of the reference point used to position the string. fuOptions Specifies how to use the application-defined rectangle. This parameter can be a combination of the following values: Value Meaning ETO_CLIPPED The text will be clipped to the rectangle. ETO_GLYPH_INDEX The lpString array refers to an array returned from GetCharacterPlacement and should be parsed directly by GDI as no further language-specific processing is required. Glyph indexing only applies to TrueType fonts, but the flag can be used for bitmap and vector fonts to indicate no further language processing is necessary and GDI should process the string directly. Note that all glyph indices are 16-bit values even though the string is assumed to be an array of 8-bit values for raster fonts. ETO_OPAQUE The current background color should be used to fill the rectangle. ETO_RTLREADING Middle-Eastern Windows: If this value is specified and a Hebrew or Arabic font is selected into the device context, the string is output using right-to-left reading order. If this value is not specified, the string is output in left- to-right order. The same effect can be achieved by setting the TA_RTLREADING value in SetTextAlign. This value is preserved for backward compatability. The ETO_GLYPH_INDEX and ETO_RTLREADING values cannot be used together. Because ETO_GLYPH_INDEX implies that all language processing has been completed, the function ignores the ETO_RTLREADING flag if also specified. lprc Pointer to an optional RECT structure that specifies the dimensions of a rectangle that is used for clipping, opaquing, or both. lpString Pointer to the character string to be drawn. The string does not need to be zero-terminated, since cbCount specifies the length of the string. cbCount Specifies the number of characters in the string. lpDx Pointer to an optional array of values that indicate the distance between origins of adjacent character cells. For example, lpDx[i] logical units separate the origins of character cell i and character cell i + 1. Return Values If the string is drawn, the return value is nonzero. If the function fails, the return value is zero. Windows NT: To get extended error information, callGetLastError. Remarks The current text-alignment settings for the specified device context determine how the reference point is used to position the text. The text-alignment settings are retrieved by calling the GetTextAlign function. The text-alignment settings are altered by calling the SetTextAlign function. If the lpDx parameter is NULL, the ExtTextOut function uses the default spacing between characters. The character-cell origins and the contents of the array pointed to by the lpDx parameter are given in logical units. A character-cell origin is defined as the upper-left corner of the character cell. By default, the current position is not used or updated by this function. However, an application can call the SetTextAlign function with the fMode parameter set to TA_UPDATECP to permit the system to use and update the current position each time the application calls ExtTextOut for a specified device context. When this flag is set, the system ignores the X and Y parameters on subsequent ExtTextOut calls. Windows CE: Windows CE supports only the following flags for the fuOptions parameter. ETO_CLIPPED ETO_OPAQUE QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in wingdi.h. Import Library: Use gdi32.lib. Unicode: Implemented as Unicode and ANSI versions on Windows and Windows NT. See Also Fonts and Text Overview, Font and Text Functions, GetTextAlign, RECT, SetBkColor, SelectObject, SetTextAlign, SetTextColor
  • 打赏
  • 举报
回复
发帖
其它技术问题

3862

社区成员

C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
帖子事件
创建了帖子
2021-03-08 05:12
社区公告
暂无公告