Presentation is loading. Please wait.

Presentation is loading. Please wait.

Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

Similar presentations


Presentation on theme: "Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep."— Presentation transcript:

1 Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during your presentation In Slide Show, click on the right mouse button Select “Meeting Minder” Select the “Action Items” tab Type in action items as they come up Click OK to dismiss this box This will automatically create an Action Item slide at the end of your presentation with your points entered. Presented By:- Anchal Sharma

2 2 Introduction Text Fonts GDI (Graphics Device Interface) Drawing and Filling Windows APIs

3 3 Text Basics (Requirements) Text Tradition Art Technology Soft proofing

4 4 Fonts Basics Family (Roman) Style (Italicize condense etc.) Size (Point 1/72“)

5 5 Font Families A font family is a set of fonts having common stroke width and serif characteristics. There are five font families. A sixth family allows an application to use the default font.

6 6 Font familyDescription DecorativeSpecifies a novelty font. An example is Old English. DontcareSpecifies a generic family name. This name is used when information about a font does not exist or does not matter. The default font is used. ModernSpecifies a monospace font with or without serifs. Monospace fonts are usually modern; examples include Pica, Elite, and Courier New. RomanSpecifies a proportional font with serifs. An example is Times New Roman. ScriptSpecifies a font that is designed to look like handwriting; examples include Script and Cursive. SwissSpecifies a proportional font without serifs. An example is Arial.

7 7 Font Size

8 8 GDI Abstraction Device Independence Responsibility of the programmer Parts Text Filled Areas Lines and curves Bitmaps

9 9 GDI Objects ClassWindows handle type CPenHPEN CBrushHBRUSH CFontHFONT CBitmapHBITMAP CPaletteHPALETTE CRgnHRGN

10 10 Device Context BeginPaint GetDC / ReleaseDC NULL param gives screen Hwnd param gives client CreateDC(“DISPLAY”,…); GetWindowDC

11 11 Fonts (Windows) GDI Fonts / Device Fonts Raster(nonscaleable) : SYSTEM_FONT, SYSTEM_FIXED_FONT, OEM_FIXED_FONT, Courier, Ms Serif, MS Sans Serif, Small Fonts stroke : Connect the dots (Modern Roman Script) Plotter fonts True Type / OpenType GetStockObject Cannot be specific about selection DEFAULT_GUI_FONT: MS Sans Serif

12 12 Font Consistency Embedding: GetOutlineTextMetrics() otmfsType=1 OUTLINETEXTMETRIC structure System Fonts Using of Fonts Enumeration User Choice Fixed type (sys fonts)

13 13 Font Storages (Windows) Historically, font sizes were large to fit standard disks. Just like.dll Raster/Vector:.fon file contains data OpenType/TrueType:.fon file is header and.ttf file contains the data

14 14 Character Set Encoding scheme Unicode (multi-byte codes) OEM Windows Vendor (external like EBCDIC)

15 15 GDI (Co-ordinates/Mapping) Mapping mode does not change messages Screen Coordinates/Client Cordinates SetViewPortOrgEx: Device SetWindowOrgEx: Logical

16 16 Mapping ModeLogical Unitx-axisy-axis MM_TEXTPixelRightDown MM_LOMETRIC0.1 mmRightUp MM_HIMETRIC0.01 mmRightUp MM_LOENGLISH0.01 in.RightUp MM_HIENGLISH0.001 in.RightUp MM_TWIPS1/1440 in.RightUp MM_ISOTROPICArbitrary (x = y)Selectable MM_ANISOTROPICArbitrary (x !=y)Selectable Mapping Modes

17 17 Logical Inches Size of inch is larger on display Size of inch is same on printer

18 18 Drawing Lines MoveTo LineTo Bezier PolyBezier PolyBezierTo Arcs AngleArc Arc, ArcTo

19 19 Creating Paths / Regions Clipping Filling Drawing Functions BeginPath(hdc) draw lines etc. connected and then EndPath(hdc) CreateRectRgn, CreateRoundRectRgn

20 20 Shapes EllipsePieRectangleChordPolygon Shapes

21 21 Styling the Shapes Fill Brush SetROP2 : Raster Operations SetFillPoly Winding Alternate FillRect, FillRoundRect

22 22 Text APIs TextOut(hdc,ystart,pString,iCount) Does not recognize null character strings GDI function TabbedTextOut(hdc,xStart,yStart,pStrin g, iCount, iNumTabs, piTabStops, xTabOrigin); iNumTabs=NULL (def 8) iNumTabs=1 (piTabStops repeated arg.)

23 23 Text API s Cont… ExtTextOut(hdc,xSt,ySt,iOpt, &rect,pString, iCount, pxDistance); ETO_CLIPPED, ETO_OPAQUE, pxDistance=spacings, null for def. DrawText(hdc,pString,iCount, &rect,iFormat); Recognize null terminated Strings. Also \n \r \t For \t use DT_EXPANDTABS If TA_CENTER then ½ text DT_TABSTOP DrawTextEx(hdc,pString,iCount,&rect, iFormat,&drawtextparams); Works on avg character increments

24 24 Text API’s Cont… SetTextCharacterExtra(hdc, iExtra); iExtra cannot be –ve (absolute value taken) TEXTMETRICS tm.Hieght is not font size it includes internal leading.font size

25 25 tagTEXTMETRIC Structure TEXTMETRIC tmHeight tmAscent tmDescent tmInternalLeading tmExternalLeading tmAveCharWidth tmMaxCharWidth tmOverhang tmDigitizedAspectX tmDigitizedAspectY tmFirstChar tmLastChar tmDefaultChar tmBreakChar tmItalic tmUnderlined tmStruckOut tmPitchAndFamily tmCharSet

26 26 Pitch & Family TMPF_FIXED_PITC H TMPF_VECTOR TMPF_TRUETYPE TMPF_DEVICE 0X01 0X02 0X03 0X04

27 27 Font API’s CreateFont, CreateFontIndirect, GetTextFace, GetTextMetrics. lfCharSet : only value with default 1 Struct: LOGFONT,CHOOSEFONT,PANOSE GetOutlineTextMetrics: PANOSE

28 28 WinNT/Win98 SetGraphicsMode(GM_ADVANCED) WinNt: escapement, orientations. SetWorldTransform Mode should be advanced

29 29 Kerning/Antialiasing DWORD GetKerningPairs( HDC hdc, DWORD nNumPairs, LPKERNINGPAIR lpkrnpair); Anti – aliasing: GetDeviceCaps

30 30 References Charles Petzold, Programming Windows, 5 th Edition Text and Fonts, Msdn Library Lines and Curves, Msdn Library K.P. Rao, Printing classes

31 31 Thank You Questions?


Download ppt "Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep."

Similar presentations


Ads by Google