問題タブ [catextlayer]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
macos - CATextLayer gets rasterized too early and it is blurred
I have some troubles with CATextLayer, that could be due to me, but I didn't find any help on this topic. I am on OS X (on iOS it should be the same).
I create a CATextLayer layers with scale factor > 1 and what I get is a blurred text. The layer is rasterized before applying the scale, I think. Is this the expected behavior? I hope it is not, because it just makes no sense... A CAShapeLayer is rasterized after that its transformation matrix is applied, why the CATextLayer should be different?
In case I am doing something wrong... what is it??
The solution I use at the moment is to set the contentsScale property of the layer to the scale factor. The problem is that this solution doesn't scale: if the scale factor of any of the parent layers changes, then contentsScale should be updated too. I should write code to traverse the layers tree to update the contentsScale properties of all CATextLayers... not exactly what I would like to do.
Another solution, that is not really a solution, is to convert the text to a shape and use a CAShapeLayer. But then I don't see the point of having CATextLayers.
A custom subclass of CALayer could help in solving this problem?
EDIT: Even CAGradientLayer is able to render its contents, like CAShapeLayer, after that its transformation matrix is applied. Can someone explain how it is possible?
EDIT 2: My guess is that paths and gradients are rendered as OpenGL display lists, so they are rasterized at the actual size on the screen by OpenGL itself. Texts are rasterized by Core Animation, so they are bitmaps for OpenGL.
I think that I will go with the contentsScale solution for the moment. Maybe, in the future, I will convert texts to shapes. In order to get best results with little work, this is the code I use now:
iphone - removeAllAnimations が呼び出された後に animationDidStart が呼び出されるのはなぜですか?
(デリゲート) でanimationDidStart
、CABasicAnimation
を更新したいCATextLayer
。ただし、ユーザーが画面に触れた場合、実行中のすべてのアニメーションを削除したいと思います[self.maskLayer removeAllAnimations];
(すべてのアニメーションが順番に再生されます)。
ただし、removeAllAnimations
何らかの理由でanimationDidStart
ANDanimationDidStop
がまだ呼び出された後、アニメーション自体は表示されません。これは明らかに私が望んでいるものではありません。
アニメーションは次のように追加されます。
これを防ぐ方法は?この問題には今までに数時間かかりました:(
ありがとう!
macos - CATextLayer グリフがクリップまたは切り捨てられる
アニメーション テキスト ラベルを作成しようとしていたところ、突然、この奇妙な問題が発生しました。ビューで CATextLayer を使用して単純なラベルを書き出そうとしています。ご覧のとおり、NSAttributedString クラスの sizeWithAttributes: を使用して、テキストの枠を計算しようとしました。これにより、レイヤーを使用して同じ属性文字列を表示しているにもかかわらず、CATextLayer に完全に適合しないフレームが生成されます。
この奇妙なフォント レンダリングの問題が発生する理由についての洞察をいただければ幸いです。
ios - CATextLayer のテキストを動的に変更する
私はこの問題を理解しようとして頭を壁から叩きつけてきました。CATextLayer を CALayer に追加しました。いくつかの操作を行った後、CATextLayer のテキストを別のものに変更したいと考えています。それを行う簡単な方法はありますか?以下に、動作しないように見えるコードがいくつかあります。
後で私はこれをメソッドで呼び出します
ただし、これを呼び出しても画面上のテキストは変更されません。
どんな助けでも素晴らしいでしょう!
iphone - CATextlayerの行数?
動的な長さの動的文字列があります。CATextlayer を使用してビューに描画します。ラップ=YESに設定しましたが、ビュー内のCATextlayerの行数を確認して、別のビューに動的フレームを設定する方法がわかりません。私を助けてください。ありがとう。
iphone - CATextlayerは行間隔を設定しますか?
CATextlayer に問題があります。私は CATextlayer にラップされた == YES を設定し、これに対して複数行を自動設定しました。しかし、行間が非常に小さく、非常に見栄えが悪いです。CATextlayer の行間隔を設定する方法はありますか? ありがとう。
c# - Monotouch で CATextLayer を使用して NSAttributedString を表示する
NSAttributedString をレンダリングするために CATextLayer を使用しています。この方法で行うと、色が正しくレンダリングされません。CTStringAttributes を使用すると、色は機能しますが、NSAttributedString はそれ自体のサイズを認識しません。これは私が使用しているコードです:
ios - CATextLayerテキストの垂直位置を設定するには?
次のコードを使用して、アプリでUILabel
とを作成しますCATextLayer
結果は
赤がUILabel
、緑がCALayer. I want to know how to vertical align the text in
CALayer , as the
UILabel です。