Now to do the calculations. Fabric comes in two widths - 45" (sometimes it isn't exactly 45 but is 44 or 46 inches wide.) or 60" wide (also not always exact). You'll take your length meausurement and double it. So for these pants you'd need 80" of fabric if you are buying 45" wide fabric. So if a yard is 36" long you'd need to divide 36" into 80" - therefore you'd need 2.222 yards - or 2.50 yards to be safe.
If the fabric is 60" wide you'd need the same amount of fabric.
So if you have pant legs that are wider than 20" you'll need to buy 60" fabric so that you can cut out your pant pieces such as this layout. You'll see the 60" fabric is folded in half here so if your pants are wider than 30" then you'll need to go to another option.