1 / 31

Windows Programming

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

aisha
Download Presentation

Windows Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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. Windows Programming Text and Fonts Presented By:- Anchal Sharma

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

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

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

  5. Font Families A fontfamily 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. Font family Description Decorative Specifies a novelty font. An example is Old English. Dontcare Specifies 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. Modern Specifies a monospace font with or without serifs. Monospace fonts are usually modern; examples include Pica, Elite, and Courier New. Roman Specifies a proportional font with serifs. An example is Times New Roman. Script Specifies a font that is designed to look like handwriting; examples include Script and Cursive. Swiss Specifies a proportional font without serifs. An example is Arial.

  7. Font Size

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

  9. Class Windows handle type CPen HPEN CBrush HBRUSH CFont HFONT CBitmap HBITMAP CPalette HPALETTE CRgn HRGN GDI Objects

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

  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. Font Consistency • Embedding: • GetOutlineTextMetrics() otmfsType=1 OUTLINETEXTMETRIC structure • System Fonts • Using of Fonts • Enumeration • User Choice • Fixed type (sys fonts)

  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. Character Set • Encoding scheme • Unicode (multi-byte codes) • OEM • Windows • Vendor (external like EBCDIC)

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

  16. Mapping Mode Logical Unit x-axis y-axis MM_TEXT Pixel Right Down MM_LOMETRIC 0.1 mm Right Up MM_HIMETRIC 0.01 mm Right Up MM_LOENGLISH 0.01 in. Right Up MM_HIENGLISH 0.001 in. Right Up MM_TWIPS 1/1440 in. Right Up MM_ISOTROPIC Arbitrary (x = y) Selectable Selectable MM_ANISOTROPIC Arbitrary (x !=y) Selectable Selectable Mapping Modes

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

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

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

  20. Shapes Shapes Ellipse Pie Polygon Chord Rectangle

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

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

  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. 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.

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

  26. TMPF_FIXED_PITCH TMPF_VECTOR TMPF_TRUETYPE TMPF_DEVICE Pitch & Family 0X01 0X02 0X03 0X04

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

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

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

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

  31. Thank You Questions?

More Related