DeviceWorkstation.st
changeset 465 731d2d077883
parent 439 9948e62438f1
child 473 e954ce348a47
equal deleted inserted replaced
464:8309335c5fc9 465:731d2d077883
  2379 !
  2379 !
  2380 
  2380 
  2381 facesInFamily:aFamilyName
  2381 facesInFamily:aFamilyName
  2382     "return a set of all available font faces in aFamily on this display"
  2382     "return a set of all available font faces in aFamily on this display"
  2383 
  2383 
       
  2384     ^ self facesInFamily:aFamilyName filtering:nil 
       
  2385 
       
  2386 
       
  2387     "
       
  2388      Display facesInFamily:'times'
       
  2389      Display facesInFamily:'fixed'
       
  2390     "
       
  2391 
       
  2392     "Modified: 27.2.1996 / 01:33:47 / cg"
       
  2393 !
       
  2394 
       
  2395 facesInFamily:aFamilyName filtering:filterBlock
       
  2396     "return a set of all available font faces in aFamily on this display.
       
  2397      But only those matching filterBlock (if nonNil)."
       
  2398 
  2384     |allFonts faces "family face"|
  2399     |allFonts faces "family face"|
  2385 
  2400 
  2386     allFonts := self listOfAvailableFonts.
  2401     allFonts := self listOfAvailableFonts.
  2387     allFonts isNil ifTrue:[^ nil].
  2402     allFonts isNil ifTrue:[^ nil].
  2388 
  2403 
  2389     faces := Set new.
  2404     faces := Set new.
  2390     allFonts do:[:fntDescr |
  2405     allFonts do:[:fntDescr |
  2391 	aFamilyName = fntDescr family ifTrue:[
  2406         aFamilyName = fntDescr family ifTrue:[
  2392 	    faces add:(fntDescr face)
  2407             (filterBlock isNil or:[filterBlock value:fntDescr]) ifTrue:[
  2393 	]
  2408                 faces add:(fntDescr face)
       
  2409             ]
       
  2410         ]
  2394     ].
  2411     ].
  2395     ^ faces asSortedCollection
  2412     ^ faces asSortedCollection
  2396 
  2413 
  2397     "
  2414     "
  2398      Display facesInFamily:'times'
  2415      Display facesInFamily:'fixed' filtering:[:f |
  2399      Display facesInFamily:'fixed'
  2416         f encoding notNil and:[f encoding startsWith:'jis']]
  2400     "
  2417     "
       
  2418 
       
  2419     "Created: 27.2.1996 / 01:33:25 / cg"
       
  2420     "Modified: 27.2.1996 / 01:34:11 / cg"
  2401 !
  2421 !
  2402 
  2422 
  2403 fontFamilies
  2423 fontFamilies
  2404     "return a set of all available font families on this display"
  2424     "return a set of all available font families on this display"
       
  2425 
       
  2426     ^ self fontFamiliesFiltering:nil
       
  2427 
       
  2428     "
       
  2429      Display fontFamilies
       
  2430     "
       
  2431 
       
  2432     "Modified: 27.2.1996 / 01:31:14 / cg"
       
  2433 !
       
  2434 
       
  2435 fontFamiliesFiltering:aFilterBlock
       
  2436     "return a set of all available font families on this display,
       
  2437      but only those matching aFilterBlock (if nonNil)."
  2405 
  2438 
  2406     |allFonts families family|
  2439     |allFonts families family|
  2407 
  2440 
  2408     allFonts := self listOfAvailableFonts.
  2441     allFonts := self listOfAvailableFonts.
  2409     allFonts isNil ifTrue:[^ nil].
  2442     allFonts isNil ifTrue:[^ nil].
  2410     families := Set new.
  2443     families := Set new.
  2411     allFonts do:[:fntDescr |
  2444     allFonts do:[:fntDescr |
  2412 	family := fntDescr family.
  2445         (aFilterBlock isNil or:[aFilterBlock value:fntDescr]) ifTrue:[
  2413 	family notNil ifTrue:[
  2446             family := fntDescr family.
  2414 	    families add:family
  2447             family notNil ifTrue:[
  2415 	]
  2448                 families add:family
       
  2449             ]
       
  2450         ]
  2416     ].
  2451     ].
  2417     ^ families asSortedCollection
  2452     ^ families asSortedCollection
  2418 
  2453 
  2419     "
  2454     "
  2420      Display fontFamilies
  2455      Display fontFamiliesFiltering:[:f | 
  2421     "
  2456         f encoding notNil and:[f encoding startsWith:'jis']]
       
  2457     "
       
  2458 
       
  2459     "Modified: 27.2.1996 / 01:31:48 / cg"
  2422 !
  2460 !
  2423 
  2461 
  2424 fullNameOf:aFontId
  2462 fullNameOf:aFontId
  2425     "return the full name of a font.
  2463     "return the full name of a font.
  2426      Here, we return nil, not knowing anything about fonts"
  2464      Here, we return nil, not knowing anything about fonts"
  2478 
  2516 
  2479 sizesInFamily:aFamilyName face:aFaceName style:aStyleName
  2517 sizesInFamily:aFamilyName face:aFaceName style:aStyleName
  2480     "return a set of all available font sizes in aFamily/aFace/aStyle
  2518     "return a set of all available font sizes in aFamily/aFace/aStyle
  2481      on this display"
  2519      on this display"
  2482 
  2520 
       
  2521     ^ self sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:nil
       
  2522 
       
  2523     "
       
  2524      Display sizesInFamily:'times' face:'medium' style:'italic'
       
  2525     "
       
  2526 
       
  2527     "Modified: 27.2.1996 / 01:38:42 / cg"
       
  2528 !
       
  2529 
       
  2530 sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
       
  2531     "return a set of all available font sizes in aFamily/aFace/aStyle
       
  2532      on this display.
       
  2533      But only those matching filter (if nonNIl)."
       
  2534 
  2483     |allFonts sizes "family face style size"|
  2535     |allFonts sizes "family face style size"|
  2484 
  2536 
  2485     allFonts := self listOfAvailableFonts.
  2537     allFonts := self listOfAvailableFonts.
  2486     allFonts isNil ifTrue:[^ nil].
  2538     allFonts isNil ifTrue:[^ nil].
  2487 
  2539 
  2488     sizes := Set new.
  2540     sizes := Set new.
  2489     allFonts do:[:fntDescr |
  2541     allFonts do:[:fntDescr |
  2490 "/        family := fntDescr at:1.
  2542         (aFamilyName = fntDescr family) ifTrue:[
  2491 "/        (family = aFamilyName) ifTrue:[
  2543             (aFaceName = fntDescr face) ifTrue:[
  2492 "/            face := fntDescr at:2.
  2544                 (aStyleName = fntDescr style) ifTrue:[
  2493 "/            (face = aFaceName) ifTrue:[
  2545                     (filter isNil or:[filter value:fntDescr]) ifTrue:[
  2494 "/                style := fntDescr at:3.
  2546                         sizes add:fntDescr size
  2495 "/                (style = aStyleName) ifTrue:[
  2547                     ]    
  2496 "/                    size := fntDescr at:4.
  2548                 ]
  2497 "/                    sizes add:size
  2549             ]
  2498 "/                ]
  2550         ]
  2499 "/            ]
       
  2500 "/        ]
       
  2501 	(aFamilyName = fntDescr family) ifTrue:[
       
  2502 	    (aFaceName = fntDescr face) ifTrue:[
       
  2503 		(aStyleName = fntDescr style) ifTrue:[
       
  2504 		    sizes add:fntDescr size
       
  2505 		]
       
  2506 	    ]
       
  2507 	]
       
  2508     ].
  2551     ].
  2509     ^ sizes
  2552     ^ sizes
  2510 
  2553 
  2511     "
  2554     "
  2512      Display sizesInFamily:'times' face:'medium' style:'italic'
  2555      Display sizesInFamily:'fixed' face:'medium' style:'roman' filtering:[:f |
  2513     "
  2556         f encoding notNil and:[f encoding startsWith:'jis']]
       
  2557     "
       
  2558 
       
  2559     "Created: 27.2.1996 / 01:37:56 / cg"
  2514 !
  2560 !
  2515 
  2561 
  2516 stylesInFamily:aFamilyName face:aFaceName
  2562 stylesInFamily:aFamilyName face:aFaceName
  2517     "return a set of all available font styles in aFamily/aFace on this display"
  2563     "return a set of all available font styles in aFamily/aFace on this display"
  2518 
  2564 
       
  2565     ^ self stylesInFamily:aFamilyName face:aFaceName filtering:nil 
       
  2566 
       
  2567     "
       
  2568      Display stylesInFamily:'times' face:'medium'
       
  2569      Display stylesInFamily:'times' face:'bold'
       
  2570     "
       
  2571 
       
  2572     "Modified: 27.2.1996 / 01:35:43 / cg"
       
  2573 !
       
  2574 
       
  2575 stylesInFamily:aFamilyName face:aFaceName filtering:filter
       
  2576     "return a set of all available font styles in aFamily/aFace on this display.
       
  2577      But only thise matching filter (if nonNil)."
       
  2578 
  2519     |allFonts styles "family face style"|
  2579     |allFonts styles "family face style"|
  2520 
  2580 
  2521     allFonts := self listOfAvailableFonts.
  2581     allFonts := self listOfAvailableFonts.
  2522     allFonts isNil ifTrue:[^ nil].
  2582     allFonts isNil ifTrue:[^ nil].
  2523 
  2583 
  2524     styles := Set new.
  2584     styles := Set new.
  2525     allFonts do:[:fntDescr |
  2585     allFonts do:[:fntDescr |
  2526 	(aFamilyName = fntDescr family) ifTrue:[
  2586         (aFamilyName = fntDescr family) ifTrue:[
  2527 	    (aFaceName = fntDescr face) ifTrue:[
  2587             (aFaceName = fntDescr face) ifTrue:[
  2528 		styles add:fntDescr style
  2588                 (filter isNil or:[filter value:fntDescr]) ifTrue:[
  2529 	    ]
  2589                     styles add:fntDescr style
  2530 	]
  2590                 ]
       
  2591             ]
       
  2592         ]
  2531     ].
  2593     ].
  2532     ^ styles asSortedCollection
  2594     ^ styles asSortedCollection
  2533 
  2595 
  2534     "
  2596     "
  2535      Display stylesInFamily:'times' face:'medium'
  2597      Display stylesInFamily:'fixed' face:'medium' filtering:[:f |
  2536      Display stylesInFamily:'times' face:'bold'
  2598         f encoding notNil and:[f encoding startsWith:'jis']]
  2537     "
  2599     "
       
  2600 
       
  2601     "Created: 27.2.1996 / 01:35:22 / cg"
  2538 !
  2602 !
  2539 
  2603 
  2540 widthOf:aString from:index1 to:index2 inFont:aFontId
  2604 widthOf:aString from:index1 to:index2 inFont:aFontId
  2541     "return the width in pixels of a substring in a specific font"
  2605     "return the width in pixels of a substring in a specific font"
  2542 
  2606 
  3761 ! !
  3825 ! !
  3762 
  3826 
  3763 !DeviceWorkstation class methodsFor:'documentation'!
  3827 !DeviceWorkstation class methodsFor:'documentation'!
  3764 
  3828 
  3765 version
  3829 version
  3766     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.71 1996-02-23 02:23:19 cg Exp $'
  3830     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.72 1996-02-27 01:09:35 cg Exp $'
  3767 ! !
  3831 ! !
  3768 DeviceWorkstation initialize!
  3832 DeviceWorkstation initialize!