How to use Segoe MDL2 icons on Win 7 ?
How to use Segoe MDL2 icons on Win 7 ?
Dear All ,
Want to use MS Segoe MDL2 icons in the application. Could you please provide help on this. Thanks in advance...!
Thanks
Shridhar
Want to use MS Segoe MDL2 icons in the application. Could you please provide help on this. Thanks in advance...!
Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
Re: How to use Segoe MDL2 icons on Win 7 ?
Want to use MS Segoe MDL2 icons in the application.
Could you please provide help on this. Thanks in advance...!
Thanks to Mr. Rao,
just a question.
I noticed the images are painted to much to the right

Code: Select all | Expand
#include "fivewin.ch"
FUNCTION MAIN()
local aData := {}
local oFont, oSymbol
local oDlg, oBrw
local n, oBtn1, oBtn2, oBtn3
FOR n := 0xE100 to 0XE140
AAdd( aData, { n, HB_UTF8CHR( n ) } )
NEXT
DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-20
IF IsWindows10()
DEFINE FONT oSymbol NAME "Segoe MDL2 Assets" SIZE 0,-20
ELSE
DEFINE FONT oSymbol NAME "Segoe UI Symbol" SIZE 0,-20
ENDIF
DEFINE DIALOG oDlg SIZE 350,550 PIXEL TRUEPIXEL FONT oFont
@ 20,20 XBROWSE oBrw SIZE -150, -20 PIXEL OF oDlg DATASOURCE aData ;
AUTOCOLS NOBORDER
// for HARBOUR = HB_NUMTOHEX
oBrw:aCols[ 1 ]:bEditValue := { || NUMTOHEX( oBrw:aRow[ 1 ] ) }
oBrw:aCols[ 2 ]:oDataFont := oSymbol
oBrw:CreateFromCode()
@ 80, 220 BTNBMP oBtn1 PROMPT " Save " RESOURCE 0xE115 TOP 2007 ROUND OF oDlg SIZE 100, 120
//FWH understands that the number 0xE105 should be displayed as a symbol.
// oBtn1:lAdjust := .T.
@ 220, 220 BTNBMP oBtn2 PROMPT " Save " RESOURCE 0xE105 LEFT 2007 ROUND OF oDlg SIZE 120, 100
@ 350, 220 BTNBMP oBtn3 PROMPT " Exit " RESOURCE 0xE10F ACTION oDlg:End() LEFT 2007 OF oDlg SIZE 120, 100
//FWH understands that the number 0xE105 should be displayed as a symbol.
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont, oSymbol
RETURN NIL
Regards
Uwe

Last edited by ukoenig on Wed Jun 19, 2019 8:03 pm, edited 4 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: How to use Segoe MDL2 icons on Win 7 ?
Hi Uwe ,
Many Thanks for this code.
Thanks
Shridhar
Many Thanks for this code.
Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
Re: How to use Segoe MDL2 icons on Win 7 ?
Bitmap and font-symbol with different adjustment

regards
Uwe


regards
Uwe

Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Giovany Vecchi
- Posts: 223
- Joined: Mon Jun 05, 2006 9:39 pm
- Location: Brasil
Re: How to use Segoe MDL2 icons on Win 7 ?
Edit the imgtxtio.prg file at line 785.
Original:
Changed file
Original:
Code: Select all | Expand
if lSegoe
nHeight := Int( Min( aRect[ 1 ] - aRect[ 3 ], aRect[ 4 ] - aRect[ 2 ] ) * 0.6 )
cFace := If( lWin10, "Segoe MDL2 Assets", "Segoe UI Symbol" )
DEFINE FONT oFont NAME cFace SIZE 0, -nHeight
if oFont:hFont == 0
lSegoe := .f.
else
cText := HB_UTF8CHR( nChr )
nBkMode := SetBkMode( hDC, TRANSPARENT )
x := Int( 0.2 * ( aRect[ 4 ] - aRect[ 2 ] ) ) //// -> line 785
aRect[ 2 ] += x
aRect[ 4 ] += x
DrawTextEx( hDC, cText, aRect, DT_CENTER + DT_VCENTER + DT_SINGLELINE, oFont:hFont, nClrText )
endif
RELEASE FONT oFont
endif
Changed file
Code: Select all | Expand
if lSegoe
nHeight := Int( Min( aRect[ 1 ] - aRect[ 3 ], aRect[ 4 ] - aRect[ 2 ] ) * 0.6 )
cFace := If( lWin10, "Segoe MDL2 Assets", "Segoe UI Symbol" )
DEFINE FONT oFont NAME cFace SIZE 0, -nHeight
if oFont:hFont == 0
lSegoe := .f.
else
cText := HB_UTF8CHR( nChr )
nBkMode := SetBkMode( hDC, TRANSPARENT )
///x := Int( 0.2 * ( aRect[ 4 ] - aRect[ 2 ] ) )
/// Change
If lWin10
x := Int( 0.1 * ( aRect[ 4 ] - aRect[ 2 ] ) )
Else
x := Int( 0.14 * ( aRect[ 4 ] - aRect[ 2 ] ) )
EndIf
/// End Change
aRect[ 2 ] += x
aRect[ 4 ] += x
DrawTextEx( hDC, cText, aRect, DT_CENTER + DT_VCENTER + DT_SINGLELINE, oFont:hFont, nClrText )
endif
RELEASE FONT oFont
endif
- nageswaragunupudi
- Posts: 10733
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 11 times
- Contact:
Re: How to use Segoe MDL2 icons on Win 7 ?
Windows 10 comes with Segoe MDL2 Assets font.
Windows 8 comes with Segoe UI Symbol font.
Windows 7 does not have these fonts.
If you use Segoe MDL2 Assets font in your application, that will not run on clients' Windows 7 computers.
Windows 8 comes with Segoe UI Symbol font.
Windows 7 does not have these fonts.
If you use Segoe MDL2 Assets font in your application, that will not run on clients' Windows 7 computers.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Giovany Vecchi
- Posts: 223
- Joined: Mon Jun 05, 2006 9:39 pm
- Location: Brasil
Re: How to use Segoe MDL2 icons on Win 7 ?
Windows 7 has the "Segoe Ui Symbol" font, but has few symbols.
- nageswaragunupudi
- Posts: 10733
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 11 times
- Contact:
Re: How to use Segoe MDL2 icons on Win 7 ?
Giovany Vecchi wrote:Windows 7 has the "Segoe Ui Symbol" font, but has few symbols.
So, it is not a good idea to use Segoe MDL2 Assets or Segoe UI Symbol for software meant to be distributed to different clients.
We can use when the software is used on our own computers or our company where we know all the computers are windows 10 or 8.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Giovany Vecchi
- Posts: 223
- Joined: Mon Jun 05, 2006 9:39 pm
- Location: Brasil
Re: How to use Segoe MDL2 icons on Win 7 ?
I did a different process.
Download the "Typograf" utility at https://www.neuber.com/typograph/
Take the font of Windows 10 "Segoe MDL2 Assets" and slve it under another name "Segoe MDL2 Assets seven" and physically named "segmdl2_7.ttf"
When running Windows 7 perform this function at the beginning of the program:
Then change in Prg "Imgtxtio.prg" the lines below in the SHOWSYMBOL () function
Download the "Typograf" utility at https://www.neuber.com/typograph/
Take the font of Windows 10 "Segoe MDL2 Assets" and slve it under another name "Segoe MDL2 Assets seven" and physically named "segmdl2_7.ttf"
When running Windows 7 perform this function at the beginning of the program:
Code: Select all | Expand
FUNCTION G_SYMBOL_INSTALL()
Local hDc, aFonts
Local lc_oDb_FrFix
If IsWindows10()
Return nil
EndIf
hDC := GetDC( WndMain():hWnd )
aFonts := ASort( GetFontNames( hDC ) )
ReleaseDC( WndMain():hWnd, hDC )
if AScan( aFonts, "Segoe MDL2 Assets Seven" ) > 0
Return Nil
endif
AddFontResource("segmdl2_7.ttf")
RETURN NIL
Then change in Prg "Imgtxtio.prg" the lines below in the SHOWSYMBOL () function
Code: Select all | Expand
cFace := If( lWin10, "Segoe MDL2 Assets", "Segoe MDL2 Assets Seven" )
DEFINE FONT oFont NAME cFace SIZE 0, -nHeight
if oFont:hFont == 0
lSegoe := .f.
else
cText := HB_UTF8CHR( nChr )
SetBkMode( hDC, 1 )
If lWin10
x := Int( 0.1 * ( aRect[ 4 ] - aRect[ 2 ] ) )
Else
x := Int( 0.14 * ( aRect[ 4 ] - aRect[ 2 ] ) )
EndIf
aRect[ 2 ] += x
aRect[ 4 ] += x
DrawTextEx( hDC, cText, aRect, DT_CENTER + DT_VCENTER + DT_SINGLELINE, oFont:hFont, nClrText )
endif
RELEASE FONT oFont
endif
Re: How to use Segoe MDL2 icons on Win 7 ?
Giovany,
thank You,
with the changes the image is shown centered now inside the button.
something else :
it would be nice to save a selected font-symbol shown in xBrowse as a image
maybe using FW_SaveImage(
or is there another solution
I tested and getting the error-message "imagetype not supported"
a solution could be : display the symbol enlarged on screen and saving
the screen-area as a transparent image.
regards
Uwe
thank You,
with the changes the image is shown centered now inside the button.
something else :
it would be nice to save a selected font-symbol shown in xBrowse as a image
maybe using FW_SaveImage(

I tested and getting the error-message "imagetype not supported"
a solution could be : display the symbol enlarged on screen and saving
the screen-area as a transparent image.
regards
Uwe

Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 10733
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 11 times
- Contact:
Re: How to use Segoe MDL2 icons on Win 7 ?
Please look into these functions in imgtxtio.prg:
FW_TextToBitmap()
FW_MakeYourBitmap()
and then
FW_SaveImage()
You may test this sample:
FW_TextToBitmap()
FW_MakeYourBitmap()
and then
FW_SaveImage()
You may test this sample:
Code: Select all | Expand
function Test()
local hBmp, oWnd, cFile
hBmp := FW_TextToBitmap( HB_UTF8CHR( 0xE105 ), { "Segoe MDL2 Assets", -40 } )
FW_SaveImage( hBmp, "SYMBOL.BMP" )
DeleteObject( hBmp )
DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd CENTERED ;
ON PAINT oWnd:DrawImage( "symbol.bmp" )
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10733
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 11 times
- Contact:
Re: How to use Segoe MDL2 icons on Win 7 ?
Mr. Giovany
Thanks for your correction to the code
We are adopting this in FWH1906.
Request you and Mr. Uwe to test and improve FW_TextToBitmap()
Thanks for your correction to the code
Code: Select all | Expand
If lWin10
x := Int( 0.1 * ( aRect[ 4 ] - aRect[ 2 ] ) )
Else
x := Int( 0.14 * ( aRect[ 4 ] - aRect[ 2 ] ) )
EndIf
We are adopting this in FWH1906.
Request you and Mr. Uwe to test and improve FW_TextToBitmap()
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: How to use Segoe MDL2 icons on Win 7 ?
Mr. Rao,
thank You very much
exactly the solution I've been looking for.
What I'm planning to do :
1. a defined size and color for a icon-set
2. selecting any font and display the included symbols with xbrowse
3. saving a symbol in any format bmp, ico or png to the defined set
- with the size and color ( 1 )
4. a project file to arrange and save the different sets
- also possible to include external icons
5. a icon-extractor from exe will be included ( tested and works )
something to do
I think it belongs to this topic
viewtopic.php?f=3&t=37319
regards
Uwe
thank You very much
exactly the solution I've been looking for.

What I'm planning to do :
1. a defined size and color for a icon-set
2. selecting any font and display the included symbols with xbrowse
3. saving a symbol in any format bmp, ico or png to the defined set
- with the size and color ( 1 )
4. a project file to arrange and save the different sets
- also possible to include external icons
5. a icon-extractor from exe will be included ( tested and works )
something to do

I think it belongs to this topic
viewtopic.php?f=3&t=37319
regards
Uwe

Last edited by ukoenig on Tue Jun 18, 2019 12:04 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 10733
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 11 times
- Contact:
Re: How to use Segoe MDL2 icons on Win 7 ?
Start with \fwh\samples\uisymbol.prg
For Mr. Shridhar, suggest websites you know which provide free icon-sets.
For Mr. Shridhar, suggest websites you know which provide free icon-sets.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Giovany Vecchi
- Posts: 223
- Joined: Mon Jun 05, 2006 9:39 pm
- Location: Brasil
Re: How to use Segoe MDL2 icons on Win 7 ?
I think it's better to use windows fonts than to create bitmaps. If you register the source in windows 7 there are no problems. Later I will change some functions so they can change the colors of the texts and symbols. For while it is thus:

